aboutsummaryrefslogtreecommitdiff
path: root/StepTileCommand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'StepTileCommand.cpp')
-rw-r--r--StepTileCommand.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/StepTileCommand.cpp b/StepTileCommand.cpp
index bac9f5d..beefd34 100644
--- a/StepTileCommand.cpp
+++ b/StepTileCommand.cpp
@@ -3,16 +3,10 @@
using namespace std;
-StepTileCommand::StepTileCommand(Canvas & c, pair<unsigned int, unsigned int> tile) : canvas(c) {
- this->x = tile.first;
- this->y = tile.second;
-}
+StepTileCommand::StepTileCommand(Canvas & c, const XY & tile) : canvas(c), tile_pos(tile) { }
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 & tile = this->canvas.get_tile(this->tile_pos);
tile.behavior->step(nullptr);
tile.update();
}