- changed some data init code to delete the data it wants to initialize first.

- The 'savebuffer' variable still existed?
- Changed AInventory::Destroy to NULL SendItemUse and SendItemDrop if they point to the destroyed object. Although unlikely it can't be ruled out completely that this can happen with delayed CCMDs.
- fixed: Starting a new game did not clear the hub statistics array.


SVN r3034 (trunk)
This commit is contained in:
Christoph Oelckers 2010-12-13 10:02:45 +00:00
parent 99b5fe29f7
commit c6525a2271
10 changed files with 31 additions and 4 deletions

View file

@ -549,6 +549,7 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
exit (0); exit (0);
// zdoom.pk3 must always be the first file loaded and the IWAD second. // zdoom.pk3 must always be the first file loaded and the IWAD second.
wadfiles.Clear();
D_AddFile (wadfiles, zdoom_wad); D_AddFile (wadfiles, zdoom_wad);
if (mIWads[wads[pickwad].Type].preload >= 0) if (mIWads[wads[pickwad].Type].preload >= 0)

View file

@ -347,6 +347,15 @@ void FDecalLib::ReadAllDecals ()
int lump, lastlump = 0; int lump, lastlump = 0;
unsigned int i; unsigned int i;
for(unsigned i=0;i<Animators.Size(); i++)
{
delete Animators[i];
}
Animators.Clear();
FDecalCombinerAnim::AnimatorList.Clear();
DecalLibrary.Clear();
while ((lump = Wads.FindLump ("DECALDEF", &lastlump)) != -1) while ((lump = Wads.FindLump ("DECALDEF", &lastlump)) != -1)
{ {
FScanner sc(lump); FScanner sc(lump);

View file

@ -180,8 +180,6 @@ wbstartstruct_t wminfo; // parms for world map / intermission
short consistancy[MAXPLAYERS][BACKUPTICS]; short consistancy[MAXPLAYERS][BACKUPTICS];
BYTE* savebuffer;
#define MAXPLMOVE (forwardmove[1]) #define MAXPLMOVE (forwardmove[1])

View file

@ -85,6 +85,8 @@ void G_AddViewAngle (int yaw);
class AActor; class AActor;
extern AActor *bodyque[BODYQUESIZE]; extern AActor *bodyque[BODYQUESIZE];
extern int bodyqueslot; extern int bodyqueslot;
class AInventory;
extern const AInventory *SendItemUse, *SendItemDrop;
#endif #endif

View file

@ -76,7 +76,7 @@ struct FHubInfo
}; };
TArray<FHubInfo> hubdata; static TArray<FHubInfo> hubdata;
void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs) void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
{ {
@ -182,3 +182,8 @@ void G_ReadHubInfo (PNGHandle *png)
G_SerializeHub(arc); G_SerializeHub(arc);
} }
} }
void G_ClearHubInfo()
{
hubdata.Clear();
}

View file

@ -119,7 +119,6 @@ bool savegamerestore;
extern int mousex, mousey; extern int mousex, mousey;
extern bool sendpause, sendsave, sendturn180, SendLand; extern bool sendpause, sendsave, sendturn180, SendLand;
extern const AInventory *SendItemUse, *SendItemDrop;
void *statcopy; // for statistics driver void *statcopy; // for statistics driver
@ -309,6 +308,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
bool wantFast; bool wantFast;
int i; int i;
G_ClearHubInfo();
if (!savegamerestore) if (!savegamerestore)
{ {
G_ClearSnapshots (); G_ClearSnapshots ();

View file

@ -514,6 +514,7 @@ void G_UnSnapshotLevel (bool keepPlayers);
struct PNGHandle; struct PNGHandle;
void G_ReadSnapshots (PNGHandle *png); void G_ReadSnapshots (PNGHandle *png);
void G_WriteSnapshots (FILE *file); void G_WriteSnapshots (FILE *file);
void G_ClearHubInfo();
enum ESkillProperty enum ESkillProperty
{ {

View file

@ -1803,7 +1803,11 @@ void DeinitIntermissions();
static void ClearMapinfo() static void ClearMapinfo()
{ {
wadclusterinfos.Clear();
wadlevelinfos.Clear();
ClearEpisodes(); ClearEpisodes();
AllSkills.Clear();
DefaultSkill = -1;
DeinitIntermissions(); DeinitIntermissions();
} }
@ -1820,6 +1824,7 @@ void G_ParseMapInfo (const char *basemapinfo)
int lump, lastlump = 0; int lump, lastlump = 0;
level_info_t gamedefaults; level_info_t gamedefaults;
ClearMapinfo();
atterm(ClearMapinfo); atterm(ClearMapinfo);
// Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3. // Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3.

View file

@ -16,6 +16,7 @@
#include "a_specialspot.h" #include "a_specialspot.h"
#include "thingdef/thingdef.h" #include "thingdef/thingdef.h"
#include "g_level.h" #include "g_level.h"
#include "g_game.h"
#include "doomstat.h" #include "doomstat.h"
static FRandom pr_restore ("RestorePos"); static FRandom pr_restore ("RestorePos");
@ -1033,6 +1034,10 @@ void AInventory::Destroy ()
} }
Inventory = NULL; Inventory = NULL;
Super::Destroy (); 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;
} }
//=========================================================================== //===========================================================================

View file

@ -101,6 +101,7 @@ int GetSpriteIndex(const char * spritename)
void FActorInfo::StaticInit () void FActorInfo::StaticInit ()
{ {
sprites.Clear();
if (sprites.Size() == 0) if (sprites.Size() == 0)
{ {
spritedef_t temp; spritedef_t temp;