diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index b02407b157..0c7cc3bf24 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -549,6 +549,7 @@ int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, exit (0); // zdoom.pk3 must always be the first file loaded and the IWAD second. + wadfiles.Clear(); D_AddFile (wadfiles, zdoom_wad); if (mIWads[wads[pickwad].Type].preload >= 0) diff --git a/src/decallib.cpp b/src/decallib.cpp index bfcc1ac147..072262da9c 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -347,6 +347,15 @@ void FDecalLib::ReadAllDecals () int lump, lastlump = 0; unsigned int i; + for(unsigned i=0;i hubdata; +static TArray hubdata; void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs) { @@ -182,3 +182,8 @@ void G_ReadHubInfo (PNGHandle *png) G_SerializeHub(arc); } } + +void G_ClearHubInfo() +{ + hubdata.Clear(); +} \ No newline at end of file diff --git a/src/g_level.cpp b/src/g_level.cpp index e3321f8840..a962d51961 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -119,7 +119,6 @@ bool savegamerestore; extern int mousex, mousey; extern bool sendpause, sendsave, sendturn180, SendLand; -extern const AInventory *SendItemUse, *SendItemDrop; void *statcopy; // for statistics driver @@ -309,6 +308,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel) bool wantFast; int i; + G_ClearHubInfo(); if (!savegamerestore) { G_ClearSnapshots (); diff --git a/src/g_level.h b/src/g_level.h index d7add35b50..6cb9d84417 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -514,6 +514,7 @@ void G_UnSnapshotLevel (bool keepPlayers); struct PNGHandle; void G_ReadSnapshots (PNGHandle *png); void G_WriteSnapshots (FILE *file); +void G_ClearHubInfo(); enum ESkillProperty { diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index adf0b2cd03..bc1a19d48d 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1803,7 +1803,11 @@ void DeinitIntermissions(); static void ClearMapinfo() { + wadclusterinfos.Clear(); + wadlevelinfos.Clear(); ClearEpisodes(); + AllSkills.Clear(); + DefaultSkill = -1; DeinitIntermissions(); } @@ -1820,6 +1824,7 @@ void G_ParseMapInfo (const char *basemapinfo) int lump, lastlump = 0; level_info_t gamedefaults; + ClearMapinfo(); atterm(ClearMapinfo); // Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3. diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 524daee77b..f059d8d3a1 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -16,6 +16,7 @@ #include "a_specialspot.h" #include "thingdef/thingdef.h" #include "g_level.h" +#include "g_game.h" #include "doomstat.h" static FRandom pr_restore ("RestorePos"); @@ -1033,6 +1034,10 @@ void AInventory::Destroy () } Inventory = NULL; Super::Destroy (); + + // Although contrived it can theoretically happen that these variables still got a pointer to this item + if (SendItemUse == this) SendItemUse = NULL; + if (SendItemDrop == this) SendItemDrop = NULL; } //=========================================================================== diff --git a/src/info.cpp b/src/info.cpp index 988c175dfe..f345a6e7f8 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -101,6 +101,7 @@ int GetSpriteIndex(const char * spritename) void FActorInfo::StaticInit () { + sprites.Clear(); if (sprites.Size() == 0) { spritedef_t temp;