From: Holger Schemel Date: Wed, 18 Sep 2019 22:04:25 +0000 (+0200) Subject: fixed updating multiple pause button gadgets when toggling pause mode X-Git-Tag: 4.1.4.0~13 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=a48a472e7e5b2e30f48a4cf29c2bf98c7de1b5af;p=rocksndiamonds.git fixed updating multiple pause button gadgets when toggling pause mode --- diff --git a/src/game.c b/src/game.c index 79fb4518..15cd4122 100644 --- a/src/game.c +++ b/src/game.c @@ -15711,8 +15711,6 @@ void MapUndoRedoButtons(void) MapGadget(game_gadget[GAME_CTRL_ID_UNDO]); MapGadget(game_gadget[GAME_CTRL_ID_REDO]); - - ModifyGadget(game_gadget[GAME_CTRL_ID_PAUSE2], GDI_CHECKED, TRUE, GDI_END); } void UnmapUndoRedoButtons(void) @@ -15722,8 +15720,21 @@ void UnmapUndoRedoButtons(void) MapGameButtonsAtSamePosition(GAME_CTRL_ID_UNDO); MapGameButtonsAtSamePosition(GAME_CTRL_ID_REDO); +} + +void ModifyPauseButtons(void) +{ + static int ids[] = + { + GAME_CTRL_ID_PAUSE, + GAME_CTRL_ID_PAUSE2, + GAME_CTRL_ID_PANEL_PAUSE, + -1 + }; + int i; - ModifyGadget(game_gadget[GAME_CTRL_ID_PAUSE2], GDI_CHECKED, FALSE, GDI_END); + for (i = 0; ids[i] > -1; i++) + ModifyGadget(game_gadget[ids[i]], GDI_CHECKED, tape.pausing, GDI_END); } static void MapGameButtonsExt(boolean on_tape) diff --git a/src/game.h b/src/game.h index 5a96d4fc..9bfa0cd5 100644 --- a/src/game.h +++ b/src/game.h @@ -452,6 +452,7 @@ void CreateGameButtons(void); void FreeGameButtons(void); void MapUndoRedoButtons(void); void UnmapUndoRedoButtons(void); +void ModifyPauseButtons(void); void MapGameButtons(void); void UnmapGameButtons(void); void RedrawGameButtons(void); diff --git a/src/tape.c b/src/tape.c index aeac3d3a..43c3c306 100644 --- a/src/tape.c +++ b/src/tape.c @@ -764,14 +764,17 @@ void TapeTogglePause(boolean toggle_mode) return; } - if (setup.show_snapshot_buttons && - game_status == GAME_MODE_PLAYING && - CheckEngineSnapshotList()) + if (game_status == GAME_MODE_PLAYING) { - if (tape.pausing) - MapUndoRedoButtons(); - else if (!tape.single_step) - UnmapUndoRedoButtons(); + if (setup.show_snapshot_buttons && CheckEngineSnapshotList()) + { + if (tape.pausing) + MapUndoRedoButtons(); + else if (!tape.single_step) + UnmapUndoRedoButtons(); + } + + ModifyPauseButtons(); } }