From: Holger Schemel <holger.schemel@virtion.de>
Date: Mon, 6 Jan 2025 14:53:08 +0000 (+0100)
Subject: fixed showing level story when playing without hall of fame after game
X-Git-Tag: 4.4.0.1~42
X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ab72ffca65bfab8f30878889f9804a9bf93767e5;p=rocksndiamonds.git

fixed showing level story when playing without hall of fame after game

If showing scores after a game is disabled, only the first level story
for a series of played levels was shown (because the game never left
the game mode "playing").
---

diff --git a/src/game.c b/src/game.c
index e110ce52..f1b37dc5 100644
--- a/src/game.c
+++ b/src/game.c
@@ -3719,18 +3719,23 @@ static void DebugPrintPlayerStatus(char *message)
 
 void InitGame(void)
 {
+  static int last_level_nr = -1;
   int full_lev_fieldx = lev_fieldx + (BorderElement != EL_EMPTY ? 2 : 0);
   int full_lev_fieldy = lev_fieldy + (BorderElement != EL_EMPTY ? 2 : 0);
   int fade_mask = REDRAW_FIELD;
   boolean restarting = (game_status == GAME_MODE_PLAYING);
+  boolean restarting_same_level = (restarting && level_nr == last_level_nr);
   boolean level_story = (game_status == GAME_MODE_STORY);
   boolean emulate_bd = TRUE;	// unless non-BOULDERDASH elements found
   boolean emulate_sp = TRUE;	// unless non-SUPAPLEX    elements found
   int initial_move_dir = MV_DOWN;
   int i, j, x, y;
 
+  // store current level number to be able to detect restarting of same level later
+  last_level_nr = level_nr;
+
   // show level info before starting the game (if any exists)
-  if (!level_editor_test_game && !restarting && !level_story && !tape.playing)
+  if (!level_editor_test_game && !restarting_same_level && !level_story && !tape.playing)
     if (ShowStoryScreen_FromInitGame())
       return;