From 1959502a0bd9132185e96ee72020b8bde256082b Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 10 Oct 2020 13:04:08 +0300 Subject: [PATCH] - clear current levels' snapshots explicitly if saved game loading fails Levels that are not defined via MAPINFO could keep stalled snapshots data preventing their loading from scratch https://forum.zdoom.org/viewtopic.php?t=70115 --- src/gamedata/g_mapinfo.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gamedata/g_mapinfo.cpp b/src/gamedata/g_mapinfo.cpp index 8c075f51c..69ed4bceb 100644 --- a/src/gamedata/g_mapinfo.cpp +++ b/src/gamedata/g_mapinfo.cpp @@ -198,6 +198,14 @@ void G_ClearSnapshots (void) { wadlevelinfos[i].Snapshot.Clean(); } + + // Clear current levels' snapshots just in case they are not defined via MAPINFO, + // so they were not handled by the loop above + if (primaryLevel && primaryLevel->info) + primaryLevel->info->Snapshot.Clean(); + if (currentVMLevel && currentVMLevel->info) + currentVMLevel->info->Snapshot.Clean(); + // Since strings are only locked when snapshotting a level, unlock them // all now, since we got rid of all the snapshots that cared about them. GlobalACSStrings.UnlockAll();