From 6739115f07b39da3ed59572faf393f9846bd4784 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Fri, 12 Jun 2020 00:03:37 +0930 Subject: basic game working --- Tile.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'Tile.cpp') 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]; +} + -- cgit v1.2.3