aboutsummaryrefslogtreecommitdiff
path: root/ToggleMuseumPauseCommand.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-21 17:54:56 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-21 17:54:56 +0200
commit10ce9f45b9551dc103272c2b2374db1c1e3b8bcb (patch)
tree4fba15ce11c42dbfadca5cf6ff7a4c0b774ff507 /ToggleMuseumPauseCommand.cpp
parent90652f512e9621e0dfac497439c7c80bf113d9d5 (diff)
add ControlBooleanCommand
Diffstat (limited to 'ToggleMuseumPauseCommand.cpp')
-rw-r--r--ToggleMuseumPauseCommand.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/ToggleMuseumPauseCommand.cpp b/ToggleMuseumPauseCommand.cpp
index bdd2ef6..82e2d30 100644
--- a/ToggleMuseumPauseCommand.cpp
+++ b/ToggleMuseumPauseCommand.cpp
@@ -1,17 +1,7 @@
#include "ToggleMuseumPauseCommand.h"
+#include "ControlBooleanCommand.h"
#include "Museum.h"
-ToggleMuseumPauseCommand::ToggleMuseumPauseCommand(Museum & m) : museum(m) {
- this->toggle = true;
-}
-
-ToggleMuseumPauseCommand::ToggleMuseumPauseCommand(Museum & m, bool set) : museum(m) {
- this->toggle = false;
- this->value = set;
-}
-
-void ToggleMuseumPauseCommand::execute() {
- if (this->toggle) this->value = !this->museum.get_pause();
- this->museum.set_pause(this->value);
-}
+ToggleMuseumPauseCommand::ToggleMuseumPauseCommand(Museum & m) : ControlBooleanCommand(m.paused) { }
+ToggleMuseumPauseCommand::ToggleMuseumPauseCommand(Museum & m, bool set) : ControlBooleanCommand(m.paused, set) { }