aboutsummaryrefslogtreecommitdiff
path: root/StepTileCommand.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-23 19:16:19 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-23 19:16:19 +0200
commit1e0a52b03fe655d7073ef20703dbb2e7646f74d3 (patch)
treef1709c2e9565d78c791653e71e6a4b26b3138423 /StepTileCommand.cpp
parent277157b3e06b2deeacbdbc8bf6190de19f88169d (diff)
add XY struct for 2d points and offsets
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();
}