- 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);
// 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)

View File

@ -347,6 +347,15 @@ void FDecalLib::ReadAllDecals ()
int lump, lastlump = 0;
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)
{
FScanner sc(lump);

View File

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

View File

@ -85,6 +85,8 @@ void G_AddViewAngle (int yaw);
class AActor;
extern AActor *bodyque[BODYQUESIZE];
extern int bodyqueslot;
class AInventory;
extern const AInventory *SendItemUse, *SendItemDrop;
#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)
{
@ -182,3 +182,8 @@ void G_ReadHubInfo (PNGHandle *png)
G_SerializeHub(arc);
}
}
void G_ClearHubInfo()
{
hubdata.Clear();
}

View File

@ -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 ();

View File

@ -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
{

View File

@ -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.

View File

@ -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;
}
//===========================================================================

View File

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