fixed updating multiple pause button gadgets when toggling pause mode
authorHolger Schemel <info@artsoft.org>
Wed, 18 Sep 2019 22:04:25 +0000 (00:04 +0200)
committerHolger Schemel <info@artsoft.org>
Wed, 18 Sep 2019 22:04:44 +0000 (00:04 +0200)
src/game.c
src/game.h
src/tape.c

index 79fb4518f4c5f685e4d01f6b8c32d61617c87e7f..15cd41222e7e30e58cba6adf857a1dc87e3c06cc 100644 (file)
@@ -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)
index 5a96d4fc630cb23fc67d253984b1ec7b8afdfe8b..9bfa0cd52d078c5d6ad6c67b02b2cd724b60fa45 100644 (file)
@@ -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);
index aeac3d3a29239b629dddd8c16d3dd6561c3cef0a..43c3c30699807efed1332e53488ab6adbf02ae5a 100644 (file)
@@ -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();
   }
 }