- Fixed: Since FMemLump is now implemented on top of FString, it never

contains a NULL point, so the GetMem() method should fake it by
  returning NULL when the string is empty. Reverted p_xlat.cpp to its
  old revision.


SVN r465 (trunk)
This commit is contained in:
Randy Heit 2007-01-28 03:17:02 +00:00
parent 37f701a462
commit ba5e77e021
3 changed files with 16 additions and 25 deletions

View file

@ -1,3 +1,9 @@
January 27, 2007
- Fixed: Since FMemLump is now implemented on top of FString, it never
contains a NULL point, so the GetMem() method should fake it by
returning NULL when the string is empty. Reverted p_xlat.cpp to its
old revision.
January 26, 2007 (Changes by Graf Zahl)
- Fixed: The rewrite of FMemLump broke the non-standard use of it in
P_TranslateLinedefs.

View file

@ -48,7 +48,6 @@
#include "w_wad.h"
#include "sc_man.h"
#include "cmdlib.h"
#include "i_system.h"
// define names for the TriggerType field of the general linedefs
@ -64,17 +63,10 @@ typedef enum
PushMany,
} triggertype_e;
BYTE *tlatetab;
static void Freetlate()
{
if (tlatetab != NULL) delete [] tlatetab;
tlatetab = NULL;
}
void P_TranslateLineDef (line_t *ld, maplinedef_t *mld)
{
static FMemLump tlatebase;
const BYTE *tlate;
short special = LittleShort(mld->special);
short tag = LittleShort(mld->tag);
DWORD flags = LittleShort(mld->flags);
@ -129,31 +121,23 @@ void P_TranslateLineDef (line_t *ld, maplinedef_t *mld)
return;
}
if (tlatetab == NULL)
// The translation lump is cached across calls to P_TranslateLineDef.
if (tlatebase.GetMem() == NULL)
{
const char *lumpname;
int lumpnum, lumplen;
if (gameinfo.gametype == GAME_Doom)
{
lumpname = "DOOMX";
tlatebase = Wads.ReadLump ("DOOMX");
}
else if (gameinfo.gametype == GAME_Strife)
{
lumpname = "STRIFEX";
tlatebase = Wads.ReadLump ("STRIFEX");
}
else
{
lumpname = "HERETICX";
tlatebase = Wads.ReadLump ("HERETICX");
}
lumpnum = Wads.GetNumForName (lumpname);
lumplen = Wads.LumpLength(lumpnum);
tlatetab = new BYTE[lumplen];
Wads.ReadLump(lumpnum, tlatetab);
atterm(Freetlate);
}
BYTE *tlate = tlatetab;
tlate = (const BYTE *)tlatebase.GetMem();
// Check if this is a regular linetype
if (tlate[0] == 'N' && tlate[1] == 'O' && tlate[2] == 'R' && tlate[3] == 'M')

View file

@ -132,7 +132,8 @@ public:
FMemLump (const FMemLump &copy);
FMemLump &operator= (const FMemLump &copy);
~FMemLump ();
void *GetMem () { return (void *)Block.GetChars(); }
void *GetMem () { return Block.Len() == 0 ? NULL : (void *)Block.GetChars(); }
unsigned int GetSize () { return Block.Len(); }
private:
FMemLump (const FString &source);