aboutsummaryrefslogtreecommitdiff
path: root/StepTileCommand.cpp
blob: cc7d62d7bfde673a836f9bc7ee3b7e47eaddccb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "StepTileCommand.h"
#include "Canvas.h"

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();
}