summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2022-05-21 22:22:09 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2022-05-21 22:22:09 +0200
commit27a55a2e841e9c248d6b055780a519a7b5ee4263 (patch)
tree275119c5a3b6d96147b30999410e42aa1d68f740 /src/game.cpp
parent41d2578d3401e38fa8600a533ad5998dc39e7be5 (diff)
Check grid bounds on cellIsEmpty
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 17000a0..47526c8 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -101,7 +101,7 @@ void GameState::render(){
}
bool GameState::cellIsEmpty(Point* p){
- return( grid[p->y][p->x] == 0 );
+ return( p->x < GRID_WIDTH && p->x >= 0 && grid[p->y][p->x] == 0 );
}
void GameState::pressRotate(){}