fixed bug with incorrectly initializing snapping in single-step mode
authorHolger Schemel <info@artsoft.org>
Mon, 21 Jan 2019 20:38:18 +0000 (21:38 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 21 Jan 2019 20:52:51 +0000 (21:52 +0100)
When in single-step mode, snapping a tile (by using either TAS snap
keys or by using snap+direction keys) is followed by immediately
returning to pause mode. While this is fine, it was also followed by
initializing snapping (just as if the keys for snapping have been
released, which is usually indeed the case when in single-step mode,
but may be followed by pressing keys for snapping again, so the game
engine gets pressed snap keys in two subsequent frames without any
frame with "no snapping" action in between). When replaying a tape
with such snap actions (as recorded while playing), there is only one
single snap action (lasting two frames) when replaying, while there
were two snap actions (both lasting one frame) when recording, which
may result in different behaviour when replaying a recorded game.
(This can easily be tested by snapping several falling gems while in
single-step mode.)

This bug was fixed by removing the incorrect initialization of
snapping when returning to pause mode in single-step mode.

src/game.c

index 52ea43293cebaf68c232005cd88121809568ab26..20157c6d347482e2de7db3b0904b5c9916b10a2f 100644 (file)
@@ -11058,10 +11058,7 @@ static void CheckSingleStepMode(struct PlayerInfo *player)
     if (!player->is_moving &&
        !player->is_pushing &&
        !player->is_dropping_pressed)
     if (!player->is_moving &&
        !player->is_pushing &&
        !player->is_dropping_pressed)
-    {
       TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
       TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
-      SnapField(player, 0, 0);                 // stop snapping
-    }
   }
 
   CheckSaveEngineSnapshot(player);
   }
 
   CheckSaveEngineSnapshot(player);