From: Holger Schemel Date: Wed, 17 Sep 2025 17:36:05 +0000 (+0200) Subject: fixed bug which causes wrong score and time after solving level X-Git-Tag: 4.4.0.6~2 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=40488781941944f2ff2a46d936fd5740a85a400d;p=rocksndiamonds.git fixed bug which causes wrong score and time after solving level This is a terrible bug that only happens if the "frames" part of the level time counter (counted in frames and seconds) overflows exactly at the moment when the level is solved, resulting in a wrong score and time (that is one second or 50 frames too low) and therefore in a better ranking in the high score table. As the game uses 50 frames per second, about 2 % of all existing score entries are affected by this bug (which can be fixed for the scores on the high score server, but not for the locally stored personal scores). --- diff --git a/src/game.c b/src/game.c index 36be17fc..4e26225d 100644 --- a/src/game.c +++ b/src/game.c @@ -12368,7 +12368,7 @@ static void CheckLevelTime(void) } } - if (!game.LevelSolved && !level.use_step_counter) + if (!level.use_step_counter) { TimePlayed++; @@ -12376,29 +12376,32 @@ static void CheckLevelTime(void) { TimeLeft--; - if (TimeLeft <= 10 && game.time_limit) - PlayTimeoutSound(TimeLeft); + if (!game.LevelSolved) + { + if (TimeLeft <= 10 && game.time_limit) + PlayTimeoutSound(TimeLeft); - /* this does not make sense: game_panel_controls[GAME_PANEL_TIME].value - is reset from other values in UpdateGameDoorValues() -- FIX THIS */ + /* this does not make sense: game_panel_controls[GAME_PANEL_TIME].value + is reset from other values in UpdateGameDoorValues() -- FIX THIS */ - game_panel_controls[GAME_PANEL_TIME].value = TimeLeft; + game_panel_controls[GAME_PANEL_TIME].value = TimeLeft; - if (!TimeLeft && game.time_limit) - { - if (level.game_engine_type == GAME_ENGINE_TYPE_BD) - { - if (game_bd.game->cave->player_state == GD_PL_LIVING) - game_bd.game->cave->player_state = GD_PL_TIMEOUT; - } - else if (level.game_engine_type == GAME_ENGINE_TYPE_EM) - { - game_em.lev->killed_out_of_time = TRUE; - } - else + if (!TimeLeft && game.time_limit) { - for (i = 0; i < MAX_PLAYERS; i++) - KillPlayer(&stored_player[i]); + if (level.game_engine_type == GAME_ENGINE_TYPE_BD) + { + if (game_bd.game->cave->player_state == GD_PL_LIVING) + game_bd.game->cave->player_state = GD_PL_TIMEOUT; + } + else if (level.game_engine_type == GAME_ENGINE_TYPE_EM) + { + game_em.lev->killed_out_of_time = TRUE; + } + else + { + for (i = 0; i < MAX_PLAYERS; i++) + KillPlayer(&stored_player[i]); + } } } }