From 1e0a52b03fe655d7073ef20703dbb2e7646f74d3 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 23 Oct 2024 19:16:19 +0200 Subject: add XY struct for 2d points and offsets --- StepTileCommand.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'StepTileCommand.cpp') 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 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(); } -- cgit v1.2.3