]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
do not remember game was switched when selected at startup, <3 @Garux
authorThomas Debesse <dev@illwieckz.net>
Sat, 14 Sep 2019 18:47:22 +0000 (20:47 +0200)
committerThomas Debesse <dev@illwieckz.net>
Sat, 14 Sep 2019 19:12:47 +0000 (21:12 +0200)
radiant/preferences.cpp
radiant/preferences.h

index 732a7401338fef4210f98d240deff67d22efc338..3794e954bc425b2ad43bf719ecae909c043e21bc 100644 (file)
@@ -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<void(int)> & 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;
 
index f2c47c03c1fd2e186572351891e910473489f0fd..f0a84d532256a4dcbc145863ca65173730fe6dca 100644 (file)
@@ -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