From 4cb7ca42003c177e3acc80075d7594e555966106 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 18 Oct 2024 16:37:02 +0200 Subject: fix command design pattern --- OpenFileGUICommand.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenFileGUICommand.cpp') diff --git a/OpenFileGUICommand.cpp b/OpenFileGUICommand.cpp index 13751b2..c23a3cf 100644 --- a/OpenFileGUICommand.cpp +++ b/OpenFileGUICommand.cpp @@ -9,17 +9,17 @@ using namespace std; -void OpenFileGUICommand::execute() { - Museum * museum = &this->get_museum(); +OpenFileGUICommand::OpenFileGUICommand(Museum & m, View & v) : museum(m), view(v) {} - ToggleMuseumPauseCommand(*museum).set(true); - this->get_view().dialog_file([](vector files, void * data) -> void { +void OpenFileGUICommand::execute() { + ToggleMuseumPauseCommand(this->museum, true); + this->view.dialog_file([](vector files, void * data) -> void { Museum * museum = static_cast(data); try { - LoadFilesCommand(*museum).execute(files); + LoadFilesCommand(*museum, files).execute(); } catch (Exception & e) { printf("%s\n", e.what()); } - }, museum); + }, &this->museum); } -- cgit v1.2.3