mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- use FSharedStringArena to handle AActor's tag strings properly. They were names before which are not case sensitive and could cause problems.
- fixed FSharedStringArena::FreeAll did not NULL TopBlock. - bumped savegame version for above changes. SVN r3100 (trunk)
This commit is contained in:
parent
ac279d00c7
commit
789c937635
7 changed files with 41 additions and 7 deletions
|
@ -39,6 +39,7 @@
|
||||||
#include "textures/textures.h"
|
#include "textures/textures.h"
|
||||||
#include "r_blend.h"
|
#include "r_blend.h"
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
|
#include "memarena.h"
|
||||||
|
|
||||||
struct subsector_t;
|
struct subsector_t;
|
||||||
//
|
//
|
||||||
|
@ -760,6 +761,7 @@ public:
|
||||||
fixed_t GetGravity() const;
|
fixed_t GetGravity() const;
|
||||||
bool IsSentient() const;
|
bool IsSentient() const;
|
||||||
const char *GetTag(const char *def = NULL) const;
|
const char *GetTag(const char *def = NULL) const;
|
||||||
|
void SetTag(const char *def);
|
||||||
|
|
||||||
|
|
||||||
// info for drawing
|
// info for drawing
|
||||||
|
@ -855,7 +857,7 @@ public:
|
||||||
int activationtype; // How the thing behaves when activated with USESPECIAL or BUMPSPECIAL
|
int activationtype; // How the thing behaves when activated with USESPECIAL or BUMPSPECIAL
|
||||||
int lastbump; // Last time the actor was bumped, used to control BUMPSPECIAL
|
int lastbump; // Last time the actor was bumped, used to control BUMPSPECIAL
|
||||||
int Score; // manipulated by score items, ACS or DECORATE. The engine doesn't use this itself for anything.
|
int Score; // manipulated by score items, ACS or DECORATE. The engine doesn't use this itself for anything.
|
||||||
FNameNoInit Tag; // Strife's tag name. FIXME: should be case sensitive!
|
FString * Tag; // Strife's tag name.
|
||||||
|
|
||||||
AActor *BlockingMobj; // Actor that blocked the last move
|
AActor *BlockingMobj; // Actor that blocked the last move
|
||||||
line_t *BlockingLine; // Line that blocked the last move
|
line_t *BlockingLine; // Line that blocked the last move
|
||||||
|
@ -927,6 +929,7 @@ public:
|
||||||
private:
|
private:
|
||||||
static AActor *TIDHash[128];
|
static AActor *TIDHash[128];
|
||||||
static inline int TIDHASH (int key) { return key & 127; }
|
static inline int TIDHASH (int key) { return key & 127; }
|
||||||
|
static FSharedStringArena mStringPropertyData;
|
||||||
|
|
||||||
friend class FActorIterator;
|
friend class FActorIterator;
|
||||||
|
|
||||||
|
|
|
@ -373,4 +373,5 @@ void FSharedStringArena::FreeAll()
|
||||||
FreeBlocks = block;
|
FreeBlocks = block;
|
||||||
}
|
}
|
||||||
memset(Buckets, 0, sizeof(Buckets));
|
memset(Buckets, 0, sizeof(Buckets));
|
||||||
|
TopBlock = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __MEMARENA_H
|
||||||
|
#define __MEMARENA_H
|
||||||
|
|
||||||
#include "zstring.h"
|
#include "zstring.h"
|
||||||
|
|
||||||
// A general purpose arena.
|
// A general purpose arena.
|
||||||
|
@ -81,3 +84,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
void *Alloc(size_t size) { return NULL; } // No access to FMemArena::Alloc for outsiders.
|
void *Alloc(size_t size) { return NULL; } // No access to FMemArena::Alloc for outsiders.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -2709,7 +2709,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
|
||||||
actor->Score = value;
|
actor->Score = value;
|
||||||
|
|
||||||
case APROP_NameTag:
|
case APROP_NameTag:
|
||||||
actor->Tag = FBehavior::StaticLookupString(value);
|
actor->SetTag(FBehavior::StaticLookupString(value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APROP_DamageFactor:
|
case APROP_DamageFactor:
|
||||||
|
|
|
@ -300,7 +300,6 @@ void AActor::Serialize (FArchive &arc)
|
||||||
<< pushfactor
|
<< pushfactor
|
||||||
<< Species
|
<< Species
|
||||||
<< Score
|
<< Score
|
||||||
<< Tag
|
|
||||||
<< lastpush << lastbump
|
<< lastpush << lastbump
|
||||||
<< PainThreshold
|
<< PainThreshold
|
||||||
<< DamageFactor
|
<< DamageFactor
|
||||||
|
@ -309,6 +308,17 @@ void AActor::Serialize (FArchive &arc)
|
||||||
<< PoisonDamage << PoisonDuration << PoisonPeriod
|
<< PoisonDamage << PoisonDuration << PoisonPeriod
|
||||||
<< ConversationRoot << Conversation;
|
<< ConversationRoot << Conversation;
|
||||||
|
|
||||||
|
{
|
||||||
|
FString tagstr;
|
||||||
|
if (arc.IsStoring() && Tag != NULL && Tag->Len() > 0) tagstr = *Tag;
|
||||||
|
arc << tagstr;
|
||||||
|
if (arc.IsLoading())
|
||||||
|
{
|
||||||
|
if (tagstr.Len() == 0) Tag = NULL;
|
||||||
|
else Tag = mStringPropertyData.Alloc(tagstr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (arc.IsLoading ())
|
if (arc.IsLoading ())
|
||||||
{
|
{
|
||||||
touching_sectorlist = NULL;
|
touching_sectorlist = NULL;
|
||||||
|
@ -5521,11 +5531,13 @@ bool AActor::IsSentient() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FSharedStringArena AActor::mStringPropertyData;
|
||||||
|
|
||||||
const char *AActor::GetTag(const char *def) const
|
const char *AActor::GetTag(const char *def) const
|
||||||
{
|
{
|
||||||
if (Tag != NAME_None)
|
if (Tag != NULL)
|
||||||
{
|
{
|
||||||
const char *tag = Tag.GetChars();
|
const char *tag = Tag->GetChars();
|
||||||
if (tag[0] == '$')
|
if (tag[0] == '$')
|
||||||
{
|
{
|
||||||
return GStrings(tag + 1);
|
return GStrings(tag + 1);
|
||||||
|
@ -5545,6 +5557,18 @@ const char *AActor::GetTag(const char *def) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AActor::SetTag(const char *def)
|
||||||
|
{
|
||||||
|
if (def == NULL || *def == 0)
|
||||||
|
{
|
||||||
|
Tag = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Tag = mStringPropertyData.Alloc(def);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AActor::ClearCounters()
|
void AActor::ClearCounters()
|
||||||
{
|
{
|
||||||
|
|
|
@ -299,7 +299,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor)
|
||||||
DEFINE_PROPERTY(tag, S, Actor)
|
DEFINE_PROPERTY(tag, S, Actor)
|
||||||
{
|
{
|
||||||
PROP_STRING_PARM(str, 0);
|
PROP_STRING_PARM(str, 0);
|
||||||
defaults->Tag = str;
|
defaults->SetTag(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
// SAVESIG should match SAVEVER.
|
// SAVESIG should match SAVEVER.
|
||||||
|
|
||||||
// MINSAVEVER is the minimum level snapshot version that can be loaded.
|
// MINSAVEVER is the minimum level snapshot version that can be loaded.
|
||||||
#define MINSAVEVER 3085
|
#define MINSAVEVER 3100
|
||||||
|
|
||||||
#if SVN_REVISION_NUMBER < MINSAVEVER
|
#if SVN_REVISION_NUMBER < MINSAVEVER
|
||||||
// If we don't know the current revision write something very high to ensure that
|
// If we don't know the current revision write something very high to ensure that
|
||||||
|
|
Loading…
Reference in a new issue