summaryrefslogtreecommitdiff
path: root/Tile.cpp
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-12 00:03:37 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-12 00:03:37 +0930
commit6739115f07b39da3ed59572faf393f9846bd4784 (patch)
treefef79a608906f46267b0e7e498cc81e058579aa8 /Tile.cpp
parent49d97e71dae1955317a316cea16f9987585ef256 (diff)
downloadfoxminesweeper-6739115f07b39da3ed59572faf393f9846bd4784.tar.gz
foxminesweeper-6739115f07b39da3ed59572faf393f9846bd4784.zip
basic game working
Diffstat (limited to 'Tile.cpp')
-rw-r--r--Tile.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/Tile.cpp b/Tile.cpp
index a2c1b3e..dfad786 100644
--- a/Tile.cpp
+++ b/Tile.cpp
@@ -19,16 +19,17 @@ Tile::Tile(int x, int y)
{
this->x = x;
this->y = y;
- //bomb_icon = new FXGIFIcon(app, bomb, IMAGE_KEEP);
- //empty_icon = new FXGIFIcon(app, empty, IMAGE_KEEP);
- //this->setIcon(bomb_icon);
+ this->neighbor_mine_count = 0;
+ //
+ // better way?
+ for (int x = 0; x < 8; x++)
+ neighbors[x] = 0;
+ this->flags = HIDDEN; /* make sure we init the flags */
}
Tile::~Tile()
{
- //delete bomb_icon;
- //delete empty_icon;
}
void
@@ -41,3 +42,12 @@ Tile::reveal()
{
this->set_flag(REVEALED);
}
+
+Tile *
+Tile::get_neighbor(int i)
+{
+ if (i < 0 || i > 8)
+ return nullptr;
+ return neighbors[i];
+}
+