From 9b125ad8dfd95e6833b4e6d6288ba2a0c6707ff3 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 10 Feb 2020 18:29:29 -0800 Subject: [PATCH] Prevent removing line if there is only one line This fixes another way you could end up typing on a non-existent line in the script editor. In a script with only 1 line, which is empty, the game would let you press backspace on it, removing the line. This results in you typing on a non-existent line. You will keep typing on it until you either close the script or press Up. If you press Up, you will be unable to get back to the non-existent line, for it doesn't exist - but the text you typed on the non-existent line will still be there, until you close the script and re-open it. --- desktop_version/src/editor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 08e0a8eb..85c2e7eb 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -546,7 +546,7 @@ void editorclass::clearscriptbuffer() void editorclass::removeline(int t) { //Remove line t from the script - if(sblength>0) + if(sblength>1) { if(sblength==t) { @@ -5387,4 +5387,4 @@ void editorinput( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map, enti } } -#endif /* NO_CUSTOM_LEVELS */ \ No newline at end of file +#endif /* NO_CUSTOM_LEVELS */