1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

FlappyBug: Persist high score to disk

Previously, the high score was only in-memory, so only persisted for as
long as the FlappyBug window was open.
This commit is contained in:
Timothy Flynn 2021-06-22 10:50:54 -04:00 committed by Andreas Kling
parent 25c53e35e7
commit 1a2053781f
3 changed files with 30 additions and 5 deletions

View file

@ -27,9 +27,9 @@ void Game::reset()
void Game::game_over()
{
if (m_highscore.value_or(0) < m_difficulty) {
m_highscore = m_difficulty;
}
if (on_game_end)
m_highscore = on_game_end(static_cast<u32>(m_difficulty));
reset();
}