- use a single TArray to allocate the memory for the lump manager's hash lists.

# Conflicts:
#	src/w_wad.cpp
#	src/w_wad.h
This commit is contained in:
Christoph Oelckers 2018-11-02 09:51:44 +01:00 committed by drfrag666
parent 08dfdd2687
commit a2760d7da2
2 changed files with 7 additions and 30 deletions

View file

@ -107,9 +107,6 @@ void uppercopy (char *to, const char *from)
}
FWadCollection::FWadCollection ()
: FirstLumpIndex(NULL), NextLumpIndex(NULL),
FirstLumpIndex_FullName(NULL), NextLumpIndex_FullName(NULL),
NumLumps(0)
{
}
@ -120,27 +117,6 @@ FWadCollection::~FWadCollection ()
void FWadCollection::DeleteAll ()
{
if (FirstLumpIndex != NULL)
{
delete[] FirstLumpIndex;
FirstLumpIndex = NULL;
}
if (NextLumpIndex != NULL)
{
delete[] NextLumpIndex;
NextLumpIndex = NULL;
}
if (FirstLumpIndex_FullName != NULL)
{
delete[] FirstLumpIndex_FullName;
FirstLumpIndex_FullName = NULL;
}
if (NextLumpIndex_FullName != NULL)
{
delete[] NextLumpIndex_FullName;
NextLumpIndex_FullName = NULL;
}
LumpInfo.Clear();
NumLumps = 0;
@ -188,10 +164,11 @@ void FWadCollection::InitMultipleFiles (TArray<FString> &filenames)
FixMacHexen();
// [RH] Set up hash table
FirstLumpIndex = new uint32_t[NumLumps];
NextLumpIndex = new uint32_t[NumLumps];
FirstLumpIndex_FullName = new uint32_t[NumLumps];
NextLumpIndex_FullName = new uint32_t[NumLumps];
Hashes.Resize(6 * NumLumps);
FirstLumpIndex = &Hashes[0];
NextLumpIndex = &Hashes[NumLumps];
FirstLumpIndex_FullName = &Hashes[NumLumps*2];
NextLumpIndex_FullName = &Hashes[NumLumps*3];
InitHashChains ();
LumpInfo.ShrinkToFit();
Files.ShrinkToFit();

View file

@ -188,18 +188,18 @@ protected:
TArray<FResourceFile *> Files;
TArray<LumpRecord> LumpInfo;
TArray<uint32_t> Hashes; // one allocation for all hash lists.
uint32_t *FirstLumpIndex; // [RH] Hashing stuff moved out of lumpinfo structure
uint32_t *NextLumpIndex;
uint32_t *FirstLumpIndex_FullName; // The same information for fully qualified paths from .zips
uint32_t *NextLumpIndex_FullName;
uint32_t NumLumps; // Not necessarily the same as LumpInfo.Size()
uint32_t NumLumps = 0; // Not necessarily the same as LumpInfo.Size()
uint32_t NumWads;
int IwadIndex;
void SkinHack (int baselump);
void InitHashChains (); // [RH] Set up the lumpinfo hashing
private: