validation game value before applying
This commit is contained in:
@@ -716,6 +716,8 @@ static void RestoreAppPri()
|
|||||||
|
|
||||||
void ChangeCurrentGame( Game g )
|
void ChangeCurrentGame( Game g )
|
||||||
{
|
{
|
||||||
|
ASSERT( g >= 0 && g < NUM_GAMES );
|
||||||
|
|
||||||
SaveGamePrefsToDisk();
|
SaveGamePrefsToDisk();
|
||||||
INPUTMAPPER->SaveMappingsToDisk(); // save mappings before switching the game
|
INPUTMAPPER->SaveMappingsToDisk(); // save mappings before switching the game
|
||||||
|
|
||||||
@@ -759,8 +761,11 @@ void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame )
|
|||||||
{
|
{
|
||||||
Game game;
|
Game game;
|
||||||
if( ini.GetValue("Options", "Game", (int&)game) )
|
if( ini.GetValue("Options", "Game", (int&)game) )
|
||||||
|
{
|
||||||
|
CLAMP( (int&)game, 0, NUM_GAMES-1 );
|
||||||
GAMESTATE->m_CurGame = game;
|
GAMESTATE->m_CurGame = game;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user