From a5eb3614481c8654e7feda33b780771b06a118a0 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 17 May 2023 08:42:50 -0700 Subject: [PATCH] Set TITLEMODE if loading level results in error After the scriptclass::startgamemode refactor, a lot of common code is still being executed even if the level loading failed. This sets the game-gamestate to TITLEMODE in gotoerrorloadinglevel(), and also returns early just in case. Fixes #975. --- desktop_version/src/Script.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index 99ceb2c3..3a1b6d5f 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -2522,6 +2522,7 @@ void scriptclass::translate_dialogue(void) static void gotoerrorloadinglevel(void) { + game.gamestate = TITLEMODE; game.createmenu(Menu::errorloadinglevel); map.nexttowercolour(); graphics.fademode = FADE_START_FADEIN; /* start fade in */ @@ -2832,7 +2833,7 @@ void scriptclass::startgamemode(const enum StartMode mode) if (!cl.load(filename)) { gotoerrorloadinglevel(); - break; + return; } cl.findstartpoint();