fixed counting last step when using steps instead of seconds
authorHolger Schemel <info@artsoft.org>
Sat, 20 Mar 2021 10:26:55 +0000 (11:26 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 1 May 2021 13:38:01 +0000 (15:38 +0200)
Before this change, the very last step was not counted anymore when
using steps instead of seconds/frames and the game already being
marked as "solved".

This change (together with the previous commit) fixes this bug.

src/game.c

index 2432ab343e0ac2fe0cdc36bc380a32f82ca78643..17df74534e201cab3dc02ce3a19e151ee5736e9e 100644 (file)
@@ -13140,7 +13140,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
        RemovePlayer(player);
     }
 
-    if (!game.LevelSolved && level.use_step_counter)
+    if (level.use_step_counter)
     {
       int i;
 
@@ -13150,14 +13150,14 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
       {
        TimeLeft--;
 
-       if (TimeLeft <= 10 && setup.time_limit)
+       if (TimeLeft <= 10 && setup.time_limit && !game.LevelSolved)
          PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
 
        game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
 
        DisplayGameControlValues();
 
-       if (!TimeLeft && setup.time_limit)
+       if (!TimeLeft && setup.time_limit && !game.LevelSolved)
          for (i = 0; i < MAX_PLAYERS; i++)
            KillPlayer(&stored_player[i]);
       }