Fix vgui_screen crashing for existing saves until v8.0

This commit is contained in:
ALLEN-PC\acj30 2025-01-05 13:37:40 -06:00 committed by Blixibon
parent 70a13c3306
commit 10f08829e5

View File

@ -184,6 +184,11 @@ CVGuiScreen::~CVGuiScreen()
int CVGuiScreen::Save(ISave& save)
{
#if MAPBASE_VER_INT < 8000
// HACKHACK: Until v8.0, mark this screen as using the new save system to prevent existing saves with vgui_screen from crashing
AddContext( "uses_new_save", "1" );
#endif
int status = BaseClass::Save(save);
if (!status)
return 0;
@ -209,6 +214,12 @@ int CVGuiScreen::Restore(IRestore& restore)
if (!status)
return 0;
#if MAPBASE_VER_INT < 8000
// HACKHACK: Until v8.0, mark this screen as using the new save system to prevent existing saves with vgui_screen from crashing
if (!HasContext( "uses_new_save", "1" ))
return status;
#endif
const int iCount = restore.ReadInt();
m_PanelOutputs.EnsureCapacity(iCount);
for (int i = 0; i < iCount; i++)