- Changed FDoorAnimation deletion so that the array takes care of it. The

original destructor approach would have necessitated a lot more supporting
  code to work as intended.


SVN r91 (trunk)
This commit is contained in:
Christoph Oelckers 2006-05-09 15:51:17 +00:00
parent 763efb3682
commit 6de9e9a433
3 changed files with 28 additions and 22 deletions

View file

@ -1,4 +1,6 @@
May 9, 2006 (Changes by Graf Zahl)
- Changed FDoorAnimation deletion so that the array takes care of it. This
eliminates some complications with the requirements a destructor has.
- Fixed: Skin definitions were never freed.
- Fixed: Names in terrain definitions were never freed. Replacing them with
FNames would have been a good idea anyway.

View file

@ -478,33 +478,41 @@ void P_SpawnDoorRaiseIn5Mins (sector_t *sec)
// Strife's animated doors. Based on Doom's unused sliding doors, but slightly different.
TArray<FDoorAnimation> DoorAnimations;
FDoorAnimation::~FDoorAnimation()
class DeletingDoorArray : public TArray<FDoorAnimation>
{
if (TextureFrames != NULL)
public:
~DeletingDoorArray()
{
delete [] TextureFrames;
TextureFrames = NULL;
for(unsigned i=0;i<Size();i++)
{
FDoorAnimation *ani = &((*this)[i]);
if (ani->TextureFrames != NULL)
{
delete [] ani->TextureFrames;
ani->TextureFrames = NULL;
}
if (ani->OpenSound != NULL)
{
delete [] ani->OpenSound;
ani->OpenSound = NULL;
}
if (ani->CloseSound != NULL)
{
delete [] ani->CloseSound;
ani->CloseSound = NULL;
}
}
}
if (OpenSound != NULL)
{
delete [] OpenSound;
OpenSound = NULL;
}
if (CloseSound != NULL)
{
delete [] CloseSound;
CloseSound = NULL;
}
}
};
DeletingDoorArray DoorAnimations;
// EV_SlidingDoor : slide a door horizontally
// (animate midtexture, then set noblocking line)
//
//
// Return index into "DoorAnimatinos" array for which door type to use
// Return index into "DoorAnimations" array for which door type to use
//
static int P_FindSlidingDoorType (int picnum)
{

View file

@ -578,12 +578,8 @@ struct FDoorAnimation
int NumTextureFrames;
char *OpenSound;
char *CloseSound;
~FDoorAnimation();
};
extern TArray<FDoorAnimation> DoorAnimations;
void P_ParseAnimatedDoor ();
class DAnimatedDoor : public DMovingCeiling