Skip to content

Commit

Permalink
🔨 Made game object on heap to fix C6262 warning (#69)
Browse files Browse the repository at this point in the history
Co-authored-by: Habiba Ayman <[email protected]>
  • Loading branch information
AhmedSobhy01 and habibayman authored May 16, 2024
1 parent 191b5dc commit 46c460e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ int main()
// Get user's choice for output file
std::string outputFileName = getUserOutputFileChoice();

// Start the game
Game game;
game.run(gameMode, "InputFiles/" + inputFileName + ".txt", outputFileName + ".txt");
// Start the game (made on the heap to avoid stack overflow since the game object is large)
Game* game = new Game;
game->run(gameMode, "InputFiles/" + inputFileName + ".txt", outputFileName + ".txt");

// Delete the game object
delete game;

return 0;
}
Expand Down

0 comments on commit 46c460e

Please sign in to comment.