summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-15 22:46:13 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-15 22:46:13 +0930
commitd7c7a5aa1f27d4be5531eaf3ba2e339e35344d6a (patch)
tree1a174fd27b583e8bdfb484a01d627a0bc2fb8c6c
parent3a41ff521bd1e95a85bf93ac77d69108a1d9c0c5 (diff)
downloadfoxminesweeper-d7c7a5aa1f27d4be5531eaf3ba2e339e35344d6a.tar.gz
foxminesweeper-d7c7a5aa1f27d4be5531eaf3ba2e339e35344d6a.zip
custom games work now
-rw-r--r--Board.cpp7
-rw-r--r--MainWindow.cpp1
2 files changed, 4 insertions, 4 deletions
diff --git a/Board.cpp b/Board.cpp
index 6fe3c71..13a6238 100644
--- a/Board.cpp
+++ b/Board.cpp
@@ -86,9 +86,9 @@ Board::new_game(int width, int height, int minecount)
this->game_won = false;
tiles.clear();
/* =reate tiles */
- for (int x = 0; x < height; x++)
+ for (int x = 0; x < width; x++)
{
- for (int y = 0; y < width; y++)
+ for (int y = 0; y < height; y++)
{
std::unique_ptr<Tile> t(new Tile(x, y));
tiles.push_back(std::move(t));
@@ -107,7 +107,7 @@ Board::reveal_all_mines()
{
tile = t.get();
/* explicitly unflag tile */
- tile->clear_flag(Tile::FLAGGED); // FIXME: doesnt work as intended, it should unflag all tiles
+ tile->clear_flag(Tile::FLAGGED);
if (tile->is_mine())
{
tile->set_flag(Tile::REVEALED);
@@ -234,5 +234,4 @@ Board::check_win()
}
return (correctflags == allowedmines) || (correcttiles == safetiles);
-
}
diff --git a/MainWindow.cpp b/MainWindow.cpp
index a27890f..59845bd 100644
--- a/MainWindow.cpp
+++ b/MainWindow.cpp
@@ -192,6 +192,7 @@ MainWindow::draw_buttons()
{
button->setIcon(bomb_icon);
button->setFrameStyle(0);
+ button->setBackColor(FXRGB(255, 0, 0)); // make mines red
}
else
{