- Merged a lot of these static destructor-only structs into regular

functions added to the exit chain with atterm so that they can be called
  in a deterministic order and not whatever order the linker decides to put
  them in.
- Fixed: DCajunMaster did not free its getspawned.
- Fixed: P_FreeLevelData() did not free ACS scripts.
- Fixed: Level snapshots were not freed at exit.
- Fixed: The save/load menu list was not freed at exit.
- Fixed: FCompressedMemFile needs a destructor to free the m_ImplodedBuffer.
- Fixed: G_DoLoadGame() did not free the engine string.
- Fixed: M_ReadSaveStrings() did not free the engine string.
- Fixed: Processing DEM_SAVEGAME did not free the pathname string.
- Added a check for truncated flats to FFlatTexture::MakeTexture() because
  Heretic's F_SKY1 is only four bytes long.
- Added a dump of the offending state to the "Cannot find state..." diagnostic.
- Fixed: FCompressedFile did not initialize m_Mode in its default constructor.
- Fixed: Heretic and Hexen status bars did not initialize ArtiRefresh.
- Fixed: PNGHandle destructor should use delete[] to free TextChunks.


SVN r111 (trunk)
This commit is contained in:
Randy Heit 2006-05-12 03:14:40 +00:00
commit 8fcf93d65a
68 changed files with 866 additions and 485 deletions

View file

@ -99,14 +99,6 @@ static void ClearEpisodes ();
static void ClearLevelInfoStrings (level_info_t *linfo);
static void ClearClusterInfoStrings (cluster_info_t *cinfo);
static struct EpisodeKiller
{
~EpisodeKiller()
{
ClearEpisodes();
}
} KillTheEpisodes;
static FRandom pr_classchoice ("RandomPlayerClassChoice");
TArray<EndSequence> EndSequences;
@ -141,23 +133,6 @@ level_locals_t level; // info about current level
static TArray<cluster_info_t> wadclusterinfos;
TArray<level_info_t> wadlevelinfos;
static struct LevelClusterInfoKiller
{
~LevelClusterInfoKiller()
{
unsigned int i;
for (i = 0; i < wadlevelinfos.Size(); ++i)
{
ClearLevelInfoStrings (&wadlevelinfos[i]);
}
for (i = 0; i < wadclusterinfos.Size(); ++i)
{
ClearClusterInfoStrings (&wadclusterinfos[i]);
}
}
} KillTheLevelAndClusterInfos;
// MAPINFO is parsed slightly differently when the map name is just a number.
static bool HexenHack;
@ -469,6 +444,8 @@ void G_ParseMapInfo ()
{
int lump, lastlump = 0;
atterm (G_UnloadMapInfo);
// Parse the default MAPINFO for the current game.
switch (gameinfo.gametype)
{
@ -1181,6 +1158,27 @@ void G_SetForEndGame (char *nextmap)
}
}
void G_UnloadMapInfo ()
{
unsigned int i;
G_ClearSnapshots ();
for (i = 0; i < wadlevelinfos.Size(); ++i)
{
ClearLevelInfoStrings (&wadlevelinfos[i]);
}
wadlevelinfos.Clear();
for (i = 0; i < wadclusterinfos.Size(); ++i)
{
ClearClusterInfoStrings (&wadclusterinfos[i]);
}
wadclusterinfos.Clear();
ClearEpisodes();
}
level_info_t *FindLevelByWarpTrans (int num)
{
for (unsigned i = wadlevelinfos.Size(); i-- != 0; )