diff options
author | Daniel Jones <admin@danieljon.es> | 2020-06-12 00:03:37 +0930 |
---|---|---|
committer | Daniel Jones <admin@danieljon.es> | 2020-06-12 00:03:37 +0930 |
commit | 6739115f07b39da3ed59572faf393f9846bd4784 (patch) | |
tree | fef79a608906f46267b0e7e498cc81e058579aa8 /Tile.cpp | |
parent | 49d97e71dae1955317a316cea16f9987585ef256 (diff) | |
download | foxminesweeper-6739115f07b39da3ed59572faf393f9846bd4784.tar.gz foxminesweeper-6739115f07b39da3ed59572faf393f9846bd4784.zip |
basic game working
Diffstat (limited to 'Tile.cpp')
-rw-r--r-- | Tile.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -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]; +} + |