mirror of https://github.com/OpenTTD/OpenTTD
(svn r11626) -Fix [FS#1529]: Pause state wasn't set correctly in multiplayer saves
parent
5acc147c1c
commit
1d9c27e235
|
@ -1677,12 +1677,12 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_MOUSELOOP:
|
||||||
if (w->IsWidgetLowered(0) != !!_pause_game) {
|
if (w->IsWidgetLowered(0) != (bool)_pause_game) {
|
||||||
w->ToggleWidgetLoweredState(0);
|
w->ToggleWidgetLoweredState(0);
|
||||||
w->InvalidateWidget(0);
|
w->InvalidateWidget(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w->IsWidgetLowered(1) != !!_fast_forward) {
|
if (w->IsWidgetLowered(1) != (bool)_fast_forward) {
|
||||||
w->ToggleWidgetLoweredState(1);
|
w->ToggleWidgetLoweredState(1);
|
||||||
w->InvalidateWidget(1);
|
w->InvalidateWidget(1);
|
||||||
}
|
}
|
||||||
|
@ -1986,12 +1986,12 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_MOUSELOOP:
|
||||||
if (w->IsWidgetLowered(0) != !!_pause_game) {
|
if (w->IsWidgetLowered(0) != (bool)_pause_game) {
|
||||||
w->ToggleWidgetLoweredState(0);
|
w->ToggleWidgetLoweredState(0);
|
||||||
SetWindowDirty(w);
|
SetWindowDirty(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w->IsWidgetLowered(1) != !!_fast_forward) {
|
if (w->IsWidgetLowered(1) != (bool)_fast_forward) {
|
||||||
w->ToggleWidgetLoweredState(1);
|
w->ToggleWidgetLoweredState(1);
|
||||||
SetWindowDirty(w);
|
SetWindowDirty(w);
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,7 +317,7 @@ static void AskUnsafeUnpauseCallback(Window *w, bool confirmed)
|
||||||
CommandCost CmdPause(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
CommandCost CmdPause(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
_pause_game += (p1 == 1) ? 1 : -1;
|
_pause_game += (p1 == 0) ? -1 : 1;
|
||||||
|
|
||||||
switch (_pause_game) {
|
switch (_pause_game) {
|
||||||
case (byte)-4:
|
case (byte)-4:
|
||||||
|
|
|
@ -912,7 +912,8 @@ void SwitchMode(int new_mode)
|
||||||
/* Update the local player for a loaded game. It is either always
|
/* Update the local player for a loaded game. It is either always
|
||||||
* player #1 (eg 0) or in the case of a dedicated server a spectator */
|
* player #1 (eg 0) or in the case of a dedicated server a spectator */
|
||||||
SetLocalPlayer(_network_dedicated ? PLAYER_SPECTATOR : PLAYER_FIRST);
|
SetLocalPlayer(_network_dedicated ? PLAYER_SPECTATOR : PLAYER_FIRST);
|
||||||
DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // decrease pause counter (was increased from opening load dialog)
|
/* Decrease pause counter (was increased from opening load dialog) */
|
||||||
|
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
|
||||||
#ifdef ENABLE_NETWORK
|
#ifdef ENABLE_NETWORK
|
||||||
if (_network_server) {
|
if (_network_server) {
|
||||||
snprintf(_network_game_info.map_name, lengthof(_network_game_info.map_name), "%s (Loaded game)", _file_to_saveload.title);
|
snprintf(_network_game_info.map_name, lengthof(_network_game_info.map_name), "%s (Loaded game)", _file_to_saveload.title);
|
||||||
|
@ -956,12 +957,15 @@ void SwitchMode(int new_mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SM_SAVE: /* Save game */
|
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) {
|
if (SaveOrLoad(_file_to_saveload.name, SL_SAVE, NO_DIRECTORY) != SL_OK) {
|
||||||
SetDParamStr(0, GetSaveLoadErrorString());
|
SetDParamStr(0, GetSaveLoadErrorString());
|
||||||
ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0);
|
ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
DeleteWindowById(WC_SAVELOAD, 0);
|
DeleteWindowById(WC_SAVELOAD, 0);
|
||||||
}
|
}
|
||||||
|
if (_networking && _pause_game == 2) _pause_game = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SM_GENRANDLAND: /* Generate random land within scenario editor */
|
case SM_GENRANDLAND: /* Generate random land within scenario editor */
|
||||||
|
|
Loading…
Reference in New Issue