From ff420be0ebb35278135c51c6d445725d90af3507 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 8 Feb 2007 21:21:17 +0000 Subject: [PATCH] fix default game selection --- stepmania/src/GameManager.cpp | 15 ++++++++++++++- stepmania/src/StepMania.cpp | 4 +--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index 50cc88c61a..3be2f51ebc 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -2353,7 +2353,20 @@ void GameManager::GetEnabledGames( vector& aGamesOut ) const const Game* GameManager::GetDefaultGame() const { - return g_Games[0]; + const Game *pDefault = NULL; + if( pDefault == NULL ) + { + for( size_t i=0; pDefault == NULL && i < ARRAYSIZE(g_Games); ++i ) + { + if( IsGameEnabled(g_Games[i]) ) + pDefault = g_Games[i]; + } + + if( pDefault == NULL ) + RageException::Throw( "No NoteSkins found" ); + } + + return pDefault; } int GameManager::GetIndexFromGame( const Game* pGame ) const diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 71fd444336..0d2539e113 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -766,9 +766,7 @@ static void SwitchToLastPlayedGame() pGame->m_szName, GAMEMAN->GetDefaultGame()->m_szName ); } - /* If the default isn't available, our default note skin is messed up. */ - if( !GAMEMAN->IsGameEnabled(pGame) ) - RageException::Throw( "Default NoteSkin for \"%s\" missing", pGame->m_szName ); + ASSERT( GAMEMAN->IsGameEnabled(pGame) ); StepMania::ChangeCurrentGame( pGame ); }