From 27a55a2e841e9c248d6b055780a519a7b5ee4263 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Sat, 21 May 2022 22:22:09 +0200 Subject: Check grid bounds on cellIsEmpty --- src/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/game.cpp') 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(){} -- cgit v1.2.3