fix cases where prefs aren't persisted in case of power loss

This commit is contained in:
Chris Danford
2004-08-22 21:42:28 +00:00
parent e03e33f728
commit c51c661fdd
2 changed files with 9 additions and 1 deletions
+6
View File
@@ -588,6 +588,8 @@ retry:
goto retry; goto retry;
} }
bool bWasOnSystemMenu = GAMESTATE->m_bIsOnSystemMenu;
/* If this is a system menu, don't let the operator key touch it! /* If this is a system menu, don't let the operator key touch it!
However, if you add an options screen, please include it here -- Miryokuteki */ However, if you add an options screen, please include it here -- Miryokuteki */
if( sClassName == "ScreenOptionsMenu" || if( sClassName == "ScreenOptionsMenu" ||
@@ -604,6 +606,10 @@ retry:
else else
GAMESTATE->m_bIsOnSystemMenu = false; GAMESTATE->m_bIsOnSystemMenu = false;
// If we're exiting a system menu, persist settings in case we don't exit normally
if( bWasOnSystemMenu && !GAMESTATE->m_bIsOnSystemMenu )
PREFSMAN->SaveGlobalPrefsToDisk();
LOG->Trace("... SetFromNewScreen"); LOG->Trace("... SetFromNewScreen");
SetFromNewScreen( pNewScreen, false ); SetFromNewScreen( pNewScreen, false );
} }
+3 -1
View File
@@ -243,9 +243,11 @@ void ResetGame( bool ReturnToFirstScreen )
SCREENMAN->SetNewScreen( FIRST_RUN_INITIAL_SCREEN ); SCREENMAN->SetNewScreen( FIRST_RUN_INITIAL_SCREEN );
else else
SCREENMAN->SetNewScreen( INITIAL_SCREEN ); SCREENMAN->SetNewScreen( INITIAL_SCREEN );
}
PREFSMAN->m_bFirstRun = false; PREFSMAN->m_bFirstRun = false;
PREFSMAN->SaveGlobalPrefsToDisk(); // persist FirstRun setting in case we don't exit normally
}
} }
static void GameLoop(); static void GameLoop();