Don't re-read game prefs at reset; it's a hack to load game prefs

and mappings after changing the game.  Do it in ChangeCurrentGame
instead.  Don't expose ReadGamePrefsFromDisk.  (This code path
is still a little overcomplicated, but it's a bit simpler now ...)
This commit is contained in:
Glenn Maynard
2005-05-19 05:12:30 +00:00
parent 0190f4024f
commit acc86207d0
2 changed files with 13 additions and 8 deletions
+13 -7
View File
@@ -83,6 +83,8 @@ char **g_argv = NULL;
static bool g_bHasFocus = true;
static bool g_bQuitting = false;
void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame );
static RageDisplay::VideoModeParams GetCurVideoModeParams()
{
return RageDisplay::VideoModeParams(
@@ -275,8 +277,6 @@ void ExitGame()
void ResetGame( bool ReturnToFirstScreen )
{
ReadGamePrefsFromDisk();
GAMESTATE->Reset();
if( !THEME->DoesThemeExist( THEME->GetCurThemeName() ) )
@@ -759,10 +759,15 @@ void ChangeCurrentGame( const Game* g )
GAMESTATE->m_pCurGame = g;
/* Load this game's preferences. If we just set an unavailable game type, this
* will change it back to the default. */
ReadGamePrefsFromDisk( false );
/* Save the newly-selected game. */
SaveGamePrefsToDisk();
/* Load keymaps for the new game. */
INPUTMAPPER->ReadMappingsFromDisk();
}
void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame )
@@ -792,11 +797,12 @@ void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame )
LOG->Warn( "Default note skin for \"%s\" missing, reverting to \"%s\"",
GAMESTATE->m_pCurGame->m_szName, GAMEMAN->GetDefaultGame()->m_szName );
GAMESTATE->m_pCurGame = GAMEMAN->GetDefaultGame();
/* Load key maps for the new game. */
INPUTMAPPER->ReadMappingsFromDisk();
}
/* Load keymaps for the new game. */
if( INPUTMAPPER )
INPUTMAPPER->ReadMappingsFromDisk();
/* If the default isn't available, our default note skin is messed up. */
if( !GAMEMAN->IsGameEnabled( GAMESTATE->m_pCurGame ) )
RageException::Throw( "Default note skin for \"%s\" missing", GAMESTATE->m_pCurGame->m_szName );
@@ -1095,8 +1101,8 @@ int main(int argc, char* argv[])
ANNOUNCER = new AnnouncerManager;
NOTESKIN = new NoteSkinManager;
/* Set up the theme and announcer. */
ReadGamePrefsFromDisk();
/* Set up the theme and announcer, and switch to the last game type. */
ReadGamePrefsFromDisk( true );
{
/* Now that THEME is loaded, load the icon for the current theme into the