Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add system for modular SBARINFO #2742

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/g_statusbar/sbarinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ enum //Key words
SBARINFO_MUGSHOT,
SBARINFO_CREATEPOPUP,
SBARINFO_PROTRUSION,
SBARINFO_APPENDSTATUSBAR,
};

enum //Bar types
Expand Down Expand Up @@ -410,6 +411,7 @@ static const char *SBarInfoTopLevel[] =
"mugshot",
"createpopup",
"protrusion",
"appendstatusbar",
NULL
};

Expand Down Expand Up @@ -629,6 +631,7 @@ void SBarInfo::ParseSBarInfo(int lump)
sc.MustGetToken(';');
break;
case SBARINFO_STATUSBAR:
case SBARINFO_APPENDSTATUSBAR:
{
if(!baseSet) //If the user didn't explicitly define a base, do so now.
gameType = GAME_Any;
Expand All @@ -638,11 +641,16 @@ void SBarInfo::ParseSBarInfo(int lump)
sc.MustGetToken(TK_Identifier);
barNum = sc.MustMatchString(StatusBars);
}
if (this->huds[barNum] != NULL)
// SBARINFO_APPENDSTATUSBAR shouldn't delete the old HUD if it exists.
const bool append = (sc.MustMatchString(SBarInfoTopLevel) == SBARINFO_APPENDSTATUSBAR);
RicardoLuis0 marked this conversation as resolved.
Show resolved Hide resolved
if (!append)
{
delete this->huds[barNum];
if (this->huds[barNum] != NULL)
{
delete this->huds[barNum];
}
this->huds[barNum] = new SBarInfoMainBlock(this);
}
this->huds[barNum] = new SBarInfoMainBlock(this);
if(barNum == STBAR_AUTOMAP)
{
automapbar = true;
Expand Down
Loading