From: Thomas Debesse Date: Sat, 14 Sep 2019 18:47:22 +0000 (+0200) Subject: do not remember game was switched when selected at startup, <3 @Garux X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d052c83e50a258421e1f51ac99b135b403c18989;p=xonotic%2Fnetradiant.git do not remember game was switched when selected at startup, <3 @Garux --- diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 732a7401..3794e954 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -285,8 +285,15 @@ void CGameDialog::GameFileImport( int value ){ if ( ( *iGame )->mGameFile != m_sGameFile ) { m_sGameFile = ( *iGame )->mGameFile; - PreferencesDialog_restartRequired( "Selected Game" ); + + // do not trigger radiant restart when switching game on startup using Global Preferences dialog + if ( !onStartup ) { + PreferencesDialog_restartRequired( "Selected Game" ); + } } + + // onStartup can only be true once, when Global Preferences are displayed at startup + onStartup = false; } void CGameDialog::GameFileExport( const Callback & importCallback ) const { @@ -451,12 +458,16 @@ void CGameDialog::Init(){ } if ( gamePrompt || !currentGameDescription ) { + onStartup = true; Create(); DoGameDialog(); // use m_nComboSelect to identify the game to run as and set the globals currentGameDescription = GameDescriptionForComboItem(); ASSERT_NOTNULL( currentGameDescription ); } + else { + onStartup = false; + } g_pGameDescription = currentGameDescription; diff --git a/radiant/preferences.h b/radiant/preferences.h index f2c47c03..f0a84d53 100644 --- a/radiant/preferences.h +++ b/radiant/preferences.h @@ -222,6 +222,11 @@ mutable int m_nComboSelect; ///< intermediate int value for combo in dialog bo public: +/*! + used to no ask for restart when switching game from Gobal Preferences window displayed on startup +*/ + +bool onStartup; /*! those settings are saved in the global prefs file I'm too lazy to wrap behind protected access, not sure this needs to be public