summaryrefslogtreecommitdiff
path: root/Games/Minesweeper/Field.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-13 14:14:38 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-13 14:14:38 +0200
commit3f37665492e8ebf5bde53176daf266f18baac18e (patch)
treee42e652aca6e4dba0269d9c86f5a8ca0c9e40c1f /Games/Minesweeper/Field.cpp
parent0dbd7b04096273189483dfc1fb28f0dc0ff3cc5c (diff)
downloadserenity-3f37665492e8ebf5bde53176daf266f18baac18e.zip
Minesweeper: Fix wrong adjacency numbers on right and bottom edges.
Diffstat (limited to 'Games/Minesweeper/Field.cpp')
-rw-r--r--Games/Minesweeper/Field.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Games/Minesweeper/Field.cpp b/Games/Minesweeper/Field.cpp
index 89f93fa716..9ae543bd49 100644
--- a/Games/Minesweeper/Field.cpp
+++ b/Games/Minesweeper/Field.cpp
@@ -50,17 +50,17 @@ void Field::for_each_neighbor_of(const Square& square, Callback callback)
callback(this->square(r - 1, c));
if (c > 0) // Left
callback(this->square(r, c - 1));
- if (r < (m_rows - 2)) // Down
+ if (r < (m_rows - 1)) // Down
callback(this->square(r + 1, c));
- if (c < (m_columns - 2)) // Right
+ if (c < (m_columns - 1)) // Right
callback(this->square(r, c + 1));
if (r > 0 && c > 0) // UpLeft
callback(this->square(r - 1, c - 1));
- if (r > 0 && c < (m_columns - 2)) // UpRight
+ if (r > 0 && c < (m_columns - 1)) // UpRight
callback(this->square(r - 1, c + 1));
- if (r < (m_rows - 2) && c > 0) // DownLeft
+ if (r < (m_rows - 1) && c > 0) // DownLeft
callback(this->square(r + 1, c - 1));
- if (r < (m_rows - 2) && c < (m_columns - 2)) // DownRight
+ if (r < (m_rows - 1) && c < (m_columns - 1)) // DownRight
callback(this->square(r + 1, c + 1));
}