From d052c83e50a258421e1f51ac99b135b403c18989 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Sat, 14 Sep 2019 20:47:22 +0200 Subject: [PATCH] do not remember game was switched when selected at startup, <3 @Garux --- radiant/preferences.cpp | 13 ++++++++++++- radiant/preferences.h | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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 -- 2.39.2