From: Holger Schemel Date: Sat, 11 Dec 2021 11:25:01 +0000 (+0100) Subject: moved code for incrementing level time step counter to separate function X-Git-Tag: 4.3.1.0~5 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=30e0b1daa5756fddf6887a3934e06e2690f57a90;p=rocksndiamonds.git moved code for incrementing level time step counter to separate function --- diff --git a/src/game.c b/src/game.c index d197e6b3..11311009 100644 --- a/src/game.c +++ b/src/game.c @@ -11599,6 +11599,35 @@ static void CheckLevelSolved(void) } } +static void CheckLevelTime_StepCounter(void) +{ + int i; + + TimePlayed++; + + if (TimeLeft > 0) + { + TimeLeft--; + + 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 && !game.LevelSolved) + for (i = 0; i < MAX_PLAYERS; i++) + KillPlayer(&stored_player[i]); + } + else if (game.no_time_limit && !game.all_players_gone) + { + game_panel_controls[GAME_PANEL_TIME].value = TimePlayed; + + DisplayGameControlValues(); + } +} + static void CheckLevelTime(void) { int i; @@ -13255,33 +13284,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) } if (level.use_step_counter) - { - int i; - - TimePlayed++; - - if (TimeLeft > 0) - { - TimeLeft--; - - 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 && !game.LevelSolved) - for (i = 0; i < MAX_PLAYERS; i++) - KillPlayer(&stored_player[i]); - } - else if (game.no_time_limit && !game.all_players_gone) - { - game_panel_controls[GAME_PANEL_TIME].value = TimePlayed; - - DisplayGameControlValues(); - } - } + CheckLevelTime_StepCounter(); if (tape.single_step && tape.recording && !tape.pausing && !player->programmed_action)