diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-18 16:37:02 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-18 16:37:02 +0200 |
commit | 4cb7ca42003c177e3acc80075d7594e555966106 (patch) | |
tree | d2f5836d70a1fa2dc1d18c4fb59f1bf1f2f91f5a /TimeTravelCommand.cpp | |
parent | d8289105193707daede1a5b59137f18e20f20aeb (diff) |
fix command design pattern
Diffstat (limited to 'TimeTravelCommand.cpp')
-rw-r--r-- | TimeTravelCommand.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/TimeTravelCommand.cpp b/TimeTravelCommand.cpp index 34468c0..44320c9 100644 --- a/TimeTravelCommand.cpp +++ b/TimeTravelCommand.cpp @@ -1,11 +1,14 @@ #include "TimeTravelCommand.h" #include "Museum.h" -void TimeTravelCommand::forwards() { - this->get_museum().skip_forward(); +TimeTravelCommand::TimeTravelCommand(Museum & m, bool forwards) : museum(m) { + this->forwards = forwards; } -void TimeTravelCommand::backwards() { - this->get_museum().skip_backward(); +void TimeTravelCommand::execute() { + if (this->forwards) + this->museum.skip_forward(); + else + this->museum.skip_backward(); } |