aboutsummaryrefslogtreecommitdiff
path: root/StepTileCommand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'StepTileCommand.cpp')
-rw-r--r--StepTileCommand.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/StepTileCommand.cpp b/StepTileCommand.cpp
index ff5c6b2..cc7d62d 100644
--- a/StepTileCommand.cpp
+++ b/StepTileCommand.cpp
@@ -1,11 +1,18 @@
#include "StepTileCommand.h"
-#include "Museum.h"
+#include "Canvas.h"
-void StepTileCommand::execute(unsigned int x, unsigned int y) {
- Museum & museum = this->get_museum();
- if (x >= museum.canvas.data.columns) return;
- if (y >= museum.canvas.data.rows) return;
- Tile & tile = museum.canvas.get_tile(x, y);
+using namespace std;
+
+StepTileCommand::StepTileCommand(Canvas & c, pair<unsigned int, unsigned int> tile) : canvas(c) {
+ this->x = tile.first;
+ this->y = tile.second;
+}
+
+void StepTileCommand::execute() {
+ Canvas & canvas = this->canvas;
+ if (this->x >= canvas.data.columns) return;
+ if (this->y >= canvas.data.rows) return;
+ Tile & tile = canvas.get_tile(this->x, this->y);
tile.step(nullptr);
tile.update();
}