mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- use a single TArray to allocate the memory for the lump manager's hash lists.
This commit is contained in:
parent
8597c9e326
commit
c07aeb7498
2 changed files with 9 additions and 43 deletions
|
@ -101,10 +101,6 @@ void uppercopy (char *to, const char *from)
|
|||
}
|
||||
|
||||
FWadCollection::FWadCollection ()
|
||||
: FirstLumpIndex(NULL), NextLumpIndex(NULL),
|
||||
FirstLumpIndex_FullName(NULL), NextLumpIndex_FullName(NULL),
|
||||
FirstLumpIndex_NoExt(NULL), NextLumpIndex_NoExt(NULL),
|
||||
NumLumps(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -115,37 +111,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;
|
||||
}
|
||||
if (FirstLumpIndex_NoExt != NULL)
|
||||
{
|
||||
delete[] FirstLumpIndex_NoExt;
|
||||
FirstLumpIndex_NoExt = NULL;
|
||||
}
|
||||
if (NextLumpIndex_NoExt != NULL)
|
||||
{
|
||||
delete[] NextLumpIndex_NoExt;
|
||||
NextLumpIndex_NoExt = NULL;
|
||||
}
|
||||
|
||||
LumpInfo.Clear();
|
||||
NumLumps = 0;
|
||||
|
||||
|
@ -193,12 +158,13 @@ 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];
|
||||
FirstLumpIndex_NoExt = new uint32_t[NumLumps];
|
||||
NextLumpIndex_NoExt = new uint32_t[NumLumps];
|
||||
Hashes.Resize(6 * NumLumps);
|
||||
FirstLumpIndex = &Hashes[0];
|
||||
NextLumpIndex = &Hashes[NumLumps];
|
||||
FirstLumpIndex_FullName = &Hashes[NumLumps*2];
|
||||
NextLumpIndex_FullName = &Hashes[NumLumps*3];
|
||||
FirstLumpIndex_NoExt = &Hashes[NumLumps*4];
|
||||
NextLumpIndex_NoExt = &Hashes[NumLumps*5];
|
||||
InitHashChains ();
|
||||
LumpInfo.ShrinkToFit();
|
||||
Files.ShrinkToFit();
|
||||
|
|
|
@ -188,6 +188,7 @@ 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;
|
||||
|
||||
|
@ -197,12 +198,11 @@ protected:
|
|||
uint32_t *FirstLumpIndex_NoExt; // The same information for fully qualified paths from .zips
|
||||
uint32_t *NextLumpIndex_NoExt;
|
||||
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue