From 6767249558cb58ba1b82ac61714760220db0cbd2 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 11 Jun 2021 15:30:29 -0700 Subject: [PATCH] Prevent losing level data with rollcredits When rollcredits is ran during in-editor playtesting, all unsaved data is lost. To prevent this, just return to the editor if rollcredits is ran, with a note saying "Rolled credits". --- desktop_version/src/Script.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index e3403817..351647ed 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -1567,9 +1567,20 @@ void scriptclass::run(void) } else if (words[0] == "rollcredits") { - game.gamestate = GAMECOMPLETE; - graphics.fademode = 4; - game.creditposition = 0; +#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR) + if (map.custommode && !map.custommodeforreal) + { + game.returntoeditor(); + ed.note = "Rolled credits"; + ed.notedelay = 45; + } + else +#endif + { + game.gamestate = GAMECOMPLETE; + graphics.fademode = 4; + game.creditposition = 0; + } } else if (words[0] == "finalmode") {