void RegisterGlobalPreferences( PreferenceSystem& preferences ){
preferences.registerPreference( "gamefile", make_property_string( g_GamesDialog.m_sGameFile ) );
preferences.registerPreference( "gamePrompt", make_property_string( g_GamesDialog.m_bGamePrompt ) );
+ preferences.registerPreference( "skipGamePromptOnce", make_property_string( g_GamesDialog.m_bSkipGamePromptOnce ) );
preferences.registerPreference( "log console", make_property_string<LogConsole>() );
}
}
void CGameDialog::Init(){
+ bool gamePrompt = false;
+
InitGlobalPrefPath();
LoadPrefs();
ScanForGames();
+
if ( mGames.empty() ) {
Error( "Didn't find any valid game file descriptions, aborting\n" );
}
CGameDescription* currentGameDescription = 0;
- if ( !m_bGamePrompt ) {
+ // m_bSkipGamePromptOnce is used to not prompt for game on restart, only on fresh startup
+ if ( m_bGamePrompt && !m_bSkipGamePromptOnce ) {
+ gamePrompt = true;
+ }
+
+ m_bSkipGamePromptOnce = false;
+ g_GamesDialog.SavePrefs();
+
+ if ( !gamePrompt ) {
// search by .game name
std::list<CGameDescription *>::iterator iGame;
for ( iGame = mGames.begin(); iGame != mGames.end(); ++iGame )
}
}
}
- if ( m_bGamePrompt || !currentGameDescription ) {
+
+ if ( gamePrompt || !currentGameDescription ) {
Create();
DoGameDialog();
// use m_nComboSelect to identify the game to run as and set the globals
currentGameDescription = GameDescriptionForComboItem();
ASSERT_NOTNULL( currentGameDescription );
}
+
g_pGameDescription = currentGameDescription;
g_pGameDescription->Dump();
g_restart_required.clear();
if ( ret == ui::alert_response::YES ) {
+ g_GamesDialog.m_bSkipGamePromptOnce = true;
Radiant_Restart();
}
}
prompt which game to load on startup
*/
bool m_bGamePrompt;
+/*!
+ when if m_bGamePrompt is true
+ do not prompt at startup which game to load this time, but prompt the next times
+ this is used to not uselessly prompt game after having restarted because user switched game
+ */
+bool m_bSkipGamePromptOnce;
/*!
log console to radiant.log
m_bForceLogConsole is an obscure forced latching situation
CGameDialog() :
m_sGameFile( "" ),
m_bGamePrompt( true ),
+ m_bSkipGamePromptOnce( false ),
m_bForceLogConsole( false ){
}
virtual ~CGameDialog();