- fixed stuck memory usage warning in options menu

https://forum.zdoom.org/viewtopic.php?t=62186
This commit is contained in:
alexey.lysiuk 2018-10-05 15:22:21 +03:00
parent 5e04678965
commit 9cffc29134

View file

@ -540,14 +540,19 @@ class CompatibilityMenu : OptionMenu
class GLTextureGLOptions : OptionMenu class GLTextureGLOptions : OptionMenu
{ {
private int mWarningIndex; private int mWarningIndex;
private string mWarningLabel;
override void Init(Menu parent, OptionMenuDescriptor desc) override void Init(Menu parent, OptionMenuDescriptor desc)
{ {
super.Init(parent, desc); super.Init(parent, desc);
// Find index of warning item placeholder
mWarningIndex = -1;
mWarningLabel = "!HQRESIZE_WARNING!";
for (int i=0; i < mDesc.mItems.Size(); ++i) for (int i=0; i < mDesc.mItems.Size(); ++i)
{ {
if (mDesc.mItems[i].mLabel == "!HQRESIZE_WARNING!") if (mDesc.mItems[i].mLabel == mWarningLabel)
{ {
mWarningIndex = i; mWarningIndex = i;
break; break;
@ -555,11 +560,22 @@ class GLTextureGLOptions : OptionMenu
} }
} }
override void OnDestroy()
{
// Restore warning item placeholder
if (mWarningIndex >= 0)
{
mDesc.mItems[mWarningIndex].mLabel = mWarningLabel;
}
Super.OnDestroy();
}
override void Ticker() override void Ticker()
{ {
Super.Ticker(); Super.Ticker();
if (mWarningIndex > 0) if (mWarningIndex >= 0)
{ {
string message; string message;