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 "r_blend.h"
|
||||
#include "s_sound.h"
|
||||
#include "memarena.h"
|
||||
|
||||
struct subsector_t;
|
||||
//
|
||||
|
@ -760,6 +761,7 @@ public:
|
|||
fixed_t GetGravity() const;
|
||||
bool IsSentient() const;
|
||||
const char *GetTag(const char *def = NULL) const;
|
||||
void SetTag(const char *def);
|
||||
|
||||
|
||||
// info for drawing
|
||||
|
@ -855,7 +857,7 @@ public:
|
|||
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 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
|
||||
line_t *BlockingLine; // Line that blocked the last move
|
||||
|
@ -927,6 +929,7 @@ public:
|
|||
private:
|
||||
static AActor *TIDHash[128];
|
||||
static inline int TIDHASH (int key) { return key & 127; }
|
||||
static FSharedStringArena mStringPropertyData;
|
||||
|
||||
friend class FActorIterator;
|
||||
|
||||
|
|
|
@ -373,4 +373,5 @@ void FSharedStringArena::FreeAll()
|
|||
FreeBlocks = block;
|
||||
}
|
||||
memset(Buckets, 0, sizeof(Buckets));
|
||||
TopBlock = NULL;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#ifndef __MEMARENA_H
|
||||
#define __MEMARENA_H
|
||||
|
||||
#include "zstring.h"
|
||||
|
||||
// A general purpose arena.
|
||||
|
@ -81,3 +84,6 @@ protected:
|
|||
private:
|
||||
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;
|
||||
|
||||
case APROP_NameTag:
|
||||
actor->Tag = FBehavior::StaticLookupString(value);
|
||||
actor->SetTag(FBehavior::StaticLookupString(value));
|
||||
break;
|
||||
|
||||
case APROP_DamageFactor:
|
||||
|
|
|
@ -300,7 +300,6 @@ void AActor::Serialize (FArchive &arc)
|
|||
<< pushfactor
|
||||
<< Species
|
||||
<< Score
|
||||
<< Tag
|
||||
<< lastpush << lastbump
|
||||
<< PainThreshold
|
||||
<< DamageFactor
|
||||
|
@ -309,6 +308,17 @@ void AActor::Serialize (FArchive &arc)
|
|||
<< PoisonDamage << PoisonDuration << PoisonPeriod
|
||||
<< 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 ())
|
||||
{
|
||||
touching_sectorlist = NULL;
|
||||
|
@ -5521,11 +5531,13 @@ bool AActor::IsSentient() const
|
|||
}
|
||||
|
||||
|
||||
FSharedStringArena AActor::mStringPropertyData;
|
||||
|
||||
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] == '$')
|
||||
{
|
||||
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()
|
||||
{
|
||||
|
|
|
@ -299,7 +299,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor)
|
|||
DEFINE_PROPERTY(tag, S, Actor)
|
||||
{
|
||||
PROP_STRING_PARM(str, 0);
|
||||
defaults->Tag = str;
|
||||
defaults->SetTag(str);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
// SAVESIG should match SAVEVER.
|
||||
|
||||
// MINSAVEVER is the minimum level snapshot version that can be loaded.
|
||||
#define MINSAVEVER 3085
|
||||
#define MINSAVEVER 3100
|
||||
|
||||
#if SVN_REVISION_NUMBER < MINSAVEVER
|
||||
// If we don't know the current revision write something very high to ensure that
|
||||
|
|
Loading…
Reference in a new issue