From aec8691c062ab46c818d10d7e1e7c17fd4810f13 Mon Sep 17 00:00:00 2001 From: BinarryCode <53833277+BinarryCode@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:30:57 -0800 Subject: [PATCH] Update sbarinfo.cpp Update code to be consistent with patch for Zandronum --- src/g_statusbar/sbarinfo.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/g_statusbar/sbarinfo.cpp b/src/g_statusbar/sbarinfo.cpp index 13d77dbe6..e626efbd8 100644 --- a/src/g_statusbar/sbarinfo.cpp +++ b/src/g_statusbar/sbarinfo.cpp @@ -490,12 +490,9 @@ void SBarInfo::ParseSBarInfo(int lump) continue; } int baselump = -2; - FString SBarInfoTopLevelString; - if(sc.GetString(SBarInfoTopLevelString)) - { // Store the string if the next token is a string, and revert scanner state afterwards - sc.UnGet(); - } - switch(sc.MustMatchString(SBarInfoTopLevel)) + // Store the command, used for the switch statement and case SBARINFO_APPENDSTATUSBAR. + const int command = sc.MustMatchString(SBarInfoTopLevel); + switch(command) { case SBARINFO_BASE: baseSet = true; @@ -647,8 +644,7 @@ void SBarInfo::ParseSBarInfo(int lump) barNum = sc.MustMatchString(StatusBars); } // SBARINFO_APPENDSTATUSBAR shouldn't delete the old HUD if it exists. - const bool append = (SBarInfoTopLevelString.CompareNoCase("appendstatusbar") == 0); - if (!append) + if (command != SBARINFO_APPENDSTATUSBAR) { if (this->huds[barNum] != NULL) { @@ -656,6 +652,10 @@ void SBarInfo::ParseSBarInfo(int lump) } this->huds[barNum] = new SBarInfoMainBlock(this); } + else if (this->huds[barNum] == NULL) + { + sc.ScriptError( "AppendStatusBar can't be used on a HUD that doesn't exist yet." ); + } if(barNum == STBAR_AUTOMAP) { automapbar = true;