- Fixed: translationtables cannot use a TAutoGrowArray because it doesn't

initialize newly added fields when growing.


SVN r675 (trunk)
This commit is contained in:
Christoph Oelckers 2008-01-07 22:07:25 +00:00
parent 9cdd0b98ce
commit ed242b32df
5 changed files with 13 additions and 7 deletions

View file

@ -1,4 +1,6 @@
January 7, 2008 (Changes by Graf Zahl)
- Fixed: translationtables cannot use a TAutoGrowArray because it doesn't
initialize newly added fields when growing.
- Added fix for Heretic IDKFA cheat by Karate Chris.
- Added fix for Strife's AlienSpectre obituary by Karate Chris.

View file

@ -2719,17 +2719,19 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
}
else
{
TArray<FRemapTable*> &tt = translationtables[TRANSLATION_LevelScripted];
while (arc << w, w != 0xffff)
{
if (w >= MAX_ACS_TRANSLATIONS)
{ // hack hack to avoid crashing
w = 0;
}
trans = translationtables[TRANSLATION_LevelScripted].GetVal(w);
while (tt.Size() <= w) tt.Push(NULL);
trans = tt[w];
if (trans == NULL)
{
trans = new FRemapTable;
translationtables[TRANSLATION_LevelScripted].SetVal(t, trans);
tt[w] = trans;
}
trans->Serialize(arc);
}

View file

@ -4675,11 +4675,13 @@ int DLevelScript::RunScript ()
sp--;
if (i >= 1 && i <= MAX_ACS_TRANSLATIONS)
{
translation = translationtables[TRANSLATION_LevelScripted].GetVal(i - 1);
TArray<FRemapTable*> &tt = translationtables[TRANSLATION_LevelScripted];
while (tt.Size() < i) tt.Push(NULL);
translation = tt[i-1];
if (translation == NULL)
{
translation = new FRemapTable;
translationtables[TRANSLATION_LevelScripted].SetVal(i - 1, translation);
tt[i-1] = translation;
}
translation->MakeIdentity();
}

View file

@ -44,7 +44,7 @@
#include "gi.h"
#include "stats.h"
TAutoGrowArray<FRemapTable *> translationtables[NUM_TRANSLATION_TABLES];
TArray<FRemapTable *> translationtables[NUM_TRANSLATION_TABLES];
/****************************************************/
/****************************************************/
@ -281,7 +281,7 @@ FRemapTable *TranslationToTable(int translation)
{
unsigned int type = GetTranslationType(translation);
unsigned int index = GetTranslationIndex(translation);
TAutoGrowArray<FRemapTable *> *slots;
TArray<FRemapTable *> *slots;
if (type <= 0 || type >= NUM_TRANSLATION_TABLES)
{

View file

@ -49,7 +49,7 @@ private:
void Alloc(int count);
};
extern TAutoGrowArray<FRemapTable *> translationtables[NUM_TRANSLATION_TABLES];
extern TArray<FRemapTable *> translationtables[NUM_TRANSLATION_TABLES];
#define TRANSLATION_SHIFT 16
#define TRANSLATION_MASK ((1<<TRANSLATION_SHIFT)-1)