aboutsummaryrefslogtreecommitdiff
path: root/StepTileCommand.cpp
blob: bac9f5dfbd54fe1b7cb110729407bb6653469aac (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.behavior->step(nullptr);
	tile.update();
}