- handle the case where SBARINFO only contains a mugshot definition and fall back to the current statusbarclass if creating an SBARINFO-based statusbar fails.

This commit is contained in:
Christoph Oelckers 2017-05-21 12:05:46 +02:00
parent e27e89b57d
commit be2cfddb17
2 changed files with 10 additions and 2 deletions

View file

@ -1576,8 +1576,7 @@ DEFINE_ACTION_FUNCTION(DSBarInfo, GetProtrusion)
DBaseStatusBar *CreateCustomStatusBar(int scriptno) DBaseStatusBar *CreateCustomStatusBar(int scriptno)
{ {
auto script = SBarInfoScript[scriptno]; auto script = SBarInfoScript[scriptno];
if (script == NULL) if (script == nullptr) return nullptr;
I_FatalError("Tried to create a status bar with no script!");
auto sbar = (DBaseStatusBar*)PClass::FindClass("SBarInfoWrapper")->CreateNew(); auto sbar = (DBaseStatusBar*)PClass::FindClass("SBarInfoWrapper")->CreateNew();
auto core = new DSBarInfo(sbar, script); auto core = new DSBarInfo(sbar, script);

View file

@ -303,6 +303,15 @@ void ST_CreateStatusBar(bool bTitleLevel)
{ {
StatusBar = CreateCustomStatusBar(SCRIPT_DEFAULT); StatusBar = CreateCustomStatusBar(SCRIPT_DEFAULT);
} }
// SBARINFO failed so try the current statusbarclass again.
if (StatusBar == nullptr)
{
auto cls = PClass::FindClass(gameinfo.statusbarclass);
if (cls != nullptr)
{
StatusBar = (DBaseStatusBar *)cls->CreateNew();
}
}
} }
if (StatusBar == nullptr) if (StatusBar == nullptr)
{ {