🐛 Fixed random infinite game generation

This commit is contained in:
2024-02-18 18:43:15 +01:00
parent 272af85c74
commit dce5862d36
2 changed files with 9 additions and 11 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ export const useActions = (grid: GridType, setGrid: React.Dispatch<React.SetStat
// Start the game with making sure the clicked cell will be empty after generation
if (gameState.status === 'idle') {
const { grid: newGrid, bombsCount: _bombsCount } = startGame(prev, gameState.difficulty as Difficulty, true, rowIndex, colIndex);
const { grid: newGrid, bombsCount: _bombsCount } = startGame(gameState.gridSize, gameState.difficulty as Difficulty, true, rowIndex, colIndex);
prev = newGrid;
bombsCount = _bombsCount;
@@ -83,7 +83,7 @@ export const useActions = (grid: GridType, setGrid: React.Dispatch<React.SetStat
// Start the game without making sure the clicked cell will be empty after generation
if (gameState.status === 'idle') {
const { grid: newGrid, bombsCount: _bombsCount } = startGame(prev, gameState.difficulty as Difficulty, false);
const { grid: newGrid, bombsCount: _bombsCount } = startGame(gameState.gridSize, gameState.difficulty as Difficulty, false);
prev = newGrid;
bombsCount = _bombsCount;