From: Holger Schemel Date: Sat, 3 Oct 2020 23:52:40 +0000 (+0200) Subject: added creating engine snapshots when using mouse click events X-Git-Tag: 4.2.0.3~9 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=38212569c2f58866417f26e9c813ed8b23c5b2c4;hp=b0a2ac4eef8d8155fb616b31899f04030746f94e added creating engine snapshots when using mouse click events Before, when using mouse click events as CE change events, clicking on a CE with mouse click event did not save a new game engine snapshot, so undo/redo of CE mouse click events did not work. With this change, undo/redo snapshots will also be created when using mouse click events. --- diff --git a/src/game.c b/src/game.c index 5e4e151f..8b77ddef 100644 --- a/src/game.c +++ b/src/game.c @@ -11200,6 +11200,15 @@ static void CheckSaveEngineSnapshot(struct PlayerInfo *player) if (!player->is_dropping) player->was_dropping = FALSE; } + + static struct MouseActionInfo mouse_action_last = { 0 }; + struct MouseActionInfo mouse_action = player->effective_mouse_action; + boolean new_released = (!mouse_action.button && mouse_action_last.button); + + if (new_released) + CheckSaveEngineSnapshotToList(); + + mouse_action_last = mouse_action; } static void CheckSingleStepMode(struct PlayerInfo *player)