From 2664f2a2d95dbc2122ff1f9b96e8569ae401892f Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 6 May 2009 15:06:57 +0000 Subject: (svn r16242) -Codechange: rework pausing -Fix [FS#2864]: autopause and manual pausing conflict with eachother -Fix: new game + pause on new game + autopause make the game not unpause on the first join --- src/openttd.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/openttd.cpp') diff --git a/src/openttd.cpp b/src/openttd.cpp index 9dac52fe9..c4e28898e 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -352,7 +352,7 @@ static void LoadIntroGame() SetLocalCompany(COMPANY_FIRST); } - _pause_game = 0; + _pause_mode = PM_UNPAUSED; _cursor.fix_at = false; CheckForMissingGlyphsInLoadedLanguagePack(); @@ -961,7 +961,7 @@ void SwitchToMode(SwitchMode new_mode) /* Execute the game-start script */ IConsoleCmdExec("exec scripts/game_start.scr 0"); /* Decrease pause counter (was increased from opening load dialog) */ - DoCommandP(0, 0, 0, CMD_PAUSE); + DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE); #ifdef ENABLE_NETWORK if (_network_server) { snprintf(_network_game_info.map_name, lengthof(_network_game_info.map_name), "%s (Loaded game)", _file_to_saveload.title); @@ -1004,14 +1004,12 @@ void SwitchToMode(SwitchMode new_mode) case SM_SAVE: // Save game /* Make network saved games on pause compatible to singleplayer */ - if (_networking && _pause_game == 1) _pause_game = 2; if (SaveOrLoad(_file_to_saveload.name, SL_SAVE, NO_DIRECTORY) != SL_OK) { SetDParamStr(0, GetSaveLoadErrorString()); ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0); } else { DeleteWindowById(WC_SAVELOAD, 0); } - if (_networking && _pause_game == 2) _pause_game = 1; break; case SM_GENRANDLAND: // Generate random land within scenario editor @@ -1038,7 +1036,7 @@ void SwitchToMode(SwitchMode new_mode) void StateGameLoop() { /* dont execute the state loop during pause */ - if (_pause_game) { + if (_pause_mode != PM_UNPAUSED) { CallWindowTickEvent(); return; } @@ -1201,9 +1199,9 @@ void GameLoop() StateGameLoop(); #endif /* ENABLE_NETWORK */ - if (!_pause_game && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations(); + if (!_pause_mode && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations(); - if (!_pause_game || _cheats.build_in_pause.value) MoveAllTextEffects(); + if (!_pause_mode || _cheats.build_in_pause.value) MoveAllTextEffects(); InputLoop(); -- cgit v1.2.3-70-g09d2