mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 06:12:19 +00:00
- 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:
parent
e27e89b57d
commit
be2cfddb17
2 changed files with 10 additions and 2 deletions
|
@ -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);
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue