aboutsummaryrefslogtreecommitdiff
path: root/OpenFileGUICommand.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-18 16:37:02 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-18 16:37:02 +0200
commit4cb7ca42003c177e3acc80075d7594e555966106 (patch)
treed2f5836d70a1fa2dc1d18c4fb59f1bf1f2f91f5a /OpenFileGUICommand.cpp
parentd8289105193707daede1a5b59137f18e20f20aeb (diff)
fix command design pattern
Diffstat (limited to 'OpenFileGUICommand.cpp')
-rw-r--r--OpenFileGUICommand.cpp12
1 files changed, 6 insertions, 6 deletions
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<string> files, void * data) -> void {
+void OpenFileGUICommand::execute() {
+ ToggleMuseumPauseCommand(this->museum, true);
+ this->view.dialog_file([](vector<string> files, void * data) -> void {
Museum * museum = static_cast<Museum *>(data);
try {
- LoadFilesCommand(*museum).execute(files);
+ LoadFilesCommand(*museum, files).execute();
} catch (Exception & e) {
printf("%s\n", e.what());
}
- }, museum);
+ }, &this->museum);
}