aboutsummaryrefslogtreecommitdiff
path: root/Tile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tile.cpp')
-rw-r--r--Tile.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/Tile.cpp b/Tile.cpp
index d73abe7..89524d0 100644
--- a/Tile.cpp
+++ b/Tile.cpp
@@ -3,6 +3,7 @@
#include "Tile.h"
#include "TileAppearance.h"
#include "TileBehavior.h"
+#include "Museum.h"
Tile::Tile(Museum & museum, TileData data) : museum(museum) {
this->set_data(data);
@@ -18,7 +19,18 @@ void Tile::update() {
this->behavior->update(*this);
}
-void Tile::step() {
- this->behavior->step();
+void Tile::step(Artist & artist) {
+ this->behavior->step(artist);
+}
+
+Tile * Tile::get_neighbor(int dx, int dy) {
+ Canvas & canvas = this->museum.canvas;
+ int x = this->x + dx;
+ int y = this->y + dy;
+ if (x < 0) return nullptr;
+ if (x > canvas.data.columns) return nullptr;
+ if (y < 0) return nullptr;
+ if (y > canvas.data.columns) return nullptr;
+ return &canvas.get_tile(x, y);
}