mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Convert SDL (mostly) to plStrings
This commit is contained in:
@ -821,21 +821,20 @@ void plClothingOutfit::ReadFromVault()
|
||||
ram.Write(sdl.sdlDataLen, sdl.sdlData);
|
||||
ram.Rewind();
|
||||
|
||||
char * sdlRecName = nil;
|
||||
int sdlRecVersion;
|
||||
plString sdlRecName;
|
||||
int sdlRecVersion;
|
||||
plStateDataRecord::ReadStreamHeader(&ram, &sdlRecName, &sdlRecVersion);
|
||||
plStateDescriptor * desc = plSDLMgr::GetInstance()->FindDescriptor(sdlRecName, sdlRecVersion);
|
||||
if (desc) {
|
||||
plStateDataRecord * sdlDataRec = new plStateDataRecord(desc);
|
||||
if (sdlDataRec->Read(&ram, 0)) {
|
||||
if (!strcmp(sdlRecName, kSDLMorphSequence))
|
||||
if (sdlRecName == kSDLMorphSequence)
|
||||
IHandleMorphSDR(sdlDataRec);
|
||||
else
|
||||
plClothingSDLModifier::HandleSingleSDR(sdlDataRec, this);
|
||||
}
|
||||
delete sdlDataRec;
|
||||
}
|
||||
delete [] sdlRecName;
|
||||
}
|
||||
nodes[i]->DecRef();
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ void plClothingSDLModifier::HandleSingleSDR(const plStateDataRecord *sdr, plClot
|
||||
int i;
|
||||
uint8_t tint[3];
|
||||
float tintScalar[3];
|
||||
if (!strcmp(sdr->GetDescriptor()->GetName(), kStrClothingDescName))
|
||||
if (sdr->GetDescriptor()->GetName() == kStrClothingDescName)
|
||||
{
|
||||
// get item from clothesItem
|
||||
plSimpleStateVariable* itemVar = sdr->FindVar(kStrItem);
|
||||
@ -284,7 +284,7 @@ void plClothingSDLModifier::HandleSingleSDR(const plStateDataRecord *sdr, plClot
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(sdr->GetDescriptor()->GetName(), kStrAppearanceDescName))
|
||||
else if (sdr->GetDescriptor()->GetName() == kStrAppearanceDescName)
|
||||
{
|
||||
// skin tints
|
||||
plSimpleStateVariable* skinVar = sdr->FindVar(kStrSkinTint);
|
||||
|
@ -134,7 +134,7 @@ void plMorphSequenceSDLMod::ISetCurrentStateFrom(const plStateDataRecord* srcSta
|
||||
plSceneObject* sobj=GetTarget();
|
||||
hsAssert(sobj, "plMorphSequenceSDLMod, nil target");
|
||||
|
||||
if (strcmp(srcState->GetDescriptor()->GetName(), kSDLMorphSequence))
|
||||
if (srcState->GetDescriptor()->GetName() != kSDLMorphSequence)
|
||||
{
|
||||
hsAssert(false, "Wrong type of state data record passed into plMorphSequenceSDLMod.");
|
||||
return;
|
||||
|
@ -110,7 +110,7 @@ void plSDLModifier::ISendNetMsg(plStateDataRecord*& state, plKey senderKey, uint
|
||||
bool plSDLModifier::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plSDLModifierMsg* sdlMsg = plSDLModifierMsg::ConvertNoRef(msg);
|
||||
if (sdlMsg && !stricmp(sdlMsg->GetSDLName(),GetSDLName()))
|
||||
if (sdlMsg && !sdlMsg->GetSDLName().CompareI(GetSDLName()))
|
||||
{
|
||||
uint32_t sendFlags = IApplyModFlags(sdlMsg->GetFlags());
|
||||
|
||||
@ -229,7 +229,7 @@ void plSDLModifier::ReceiveState(const plStateDataRecord* srcState)
|
||||
plNetObjectDebugger::GetInstance()->SetDebugging(false);
|
||||
}
|
||||
|
||||
void plSDLModifier::AddNotifyForVar(plKey key, const char* varName, float tolerance) const
|
||||
void plSDLModifier::AddNotifyForVar(plKey key, const plString& varName, float tolerance) const
|
||||
{
|
||||
// create a SDL notifier object
|
||||
plStateChangeNotifier notifier(tolerance, key);
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
plStateDataRecord* GetStateCache() const { return fStateCache; }
|
||||
virtual void AddTarget(plSceneObject* so);
|
||||
|
||||
void AddNotifyForVar(plKey key, const char* varName, float tolerance) const;
|
||||
void AddNotifyForVar(plKey key, const plString& varName, float tolerance) const;
|
||||
};
|
||||
|
||||
#endif // plSDLModifier_inc
|
||||
|
@ -385,13 +385,11 @@ bool plLinkEffectsMgr::MsgReceive(plMessage *msg)
|
||||
bool linkFromACA = prevAgeName && !stricmp(prevAgeName, kAvCustomizationFilename);
|
||||
|
||||
bool linkToFissureDrop = lm &&
|
||||
lm->GetAgeLink()->HasSpawnPt() &&
|
||||
lm->GetAgeLink()->SpawnPoint().GetName() &&
|
||||
!stricmp(lm->GetAgeLink()->SpawnPoint().GetName(), kCleftAgeLinkInPointFissureDrop);
|
||||
lm->GetAgeLink()->HasSpawnPt() &&
|
||||
!lm->GetAgeLink()->SpawnPoint().GetName().CompareI(kCleftAgeLinkInPointFissureDrop);
|
||||
bool linkToDsntFromShell = lm &&
|
||||
lm->GetAgeLink()->HasSpawnPt() &&
|
||||
lm->GetAgeLink()->SpawnPoint().GetTitle() &&
|
||||
!stricmp(lm->GetAgeLink()->SpawnPoint().GetTitle(), kDescentLinkFromShell);
|
||||
lm->GetAgeLink()->HasSpawnPt() &&
|
||||
!lm->GetAgeLink()->SpawnPoint().GetTitle().CompareI(kDescentLinkFromShell);
|
||||
if ( linkToACA || linkFromACA || linkToStartup || linkFromStartup || linkToFissureDrop || linkToDsntFromShell)
|
||||
{
|
||||
BCMsg->SetLinkFlag(plLinkEffectBCMsg::kMute);
|
||||
|
@ -270,8 +270,8 @@ void plNCAgeJoiner::ExecNextOp () {
|
||||
avatarName = "Male";
|
||||
else
|
||||
avatarName = NetCommGetPlayer()->avatarDatasetName;
|
||||
const char * linkInName = plNetLinkingMgr::GetInstance()->GetAgeLink()->SpawnPoint().GetName();
|
||||
am->LoadPlayer( avatarName, nil, linkInName );
|
||||
plString linkInName = plNetLinkingMgr::GetInstance()->GetAgeLink()->SpawnPoint().GetName();
|
||||
am->LoadPlayer( avatarName, nil, linkInName.c_str() );
|
||||
}
|
||||
else {
|
||||
LogMsg(kLogPerf, L"AgeJoiner: Next:kPropagatePlayer");
|
||||
|
@ -624,7 +624,7 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs)
|
||||
// discard the state if object not found in dataset.
|
||||
hsLogEntry( DebugMsg( "Failed to find object %s in dataset. Discarding pending state '%s'",
|
||||
tmpUoid.StringIze().c_str(),
|
||||
pl->fSDRec->GetDescriptor()->GetName() ) );
|
||||
pl->fSDRec->GetDescriptor()->GetName().c_str() ) );
|
||||
delete pl;
|
||||
it = fPendingLoads.erase(it);
|
||||
continue;
|
||||
@ -645,9 +645,10 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs)
|
||||
#ifdef HS_DEBUGGING
|
||||
if (plNetObjectDebugger::GetInstance()->IsDebugObject(so))
|
||||
{
|
||||
hsLogEntry( DebugMsg( "Delivering SDL state %s:%s", pl->fKey->GetName().c_str(), pl->fSDRec->GetDescriptor()->GetName() ) );
|
||||
// hsLogEntry(plNetObjectDebugger::GetInstance()->LogMsg(xtl::format("Dispatching SDL state, type %s to object:%s, locallyOwned=%d, st=%.3f rt=%.3f",
|
||||
// pl->fSDRec->GetDescriptor()->GetName(), pl->fKey->GetName(),
|
||||
hsLogEntry( DebugMsg( "Delivering SDL state %s:%s", pl->fKey->GetName().c_str(),
|
||||
pl->fSDRec->GetDescriptor()->GetName().c_str() ) );
|
||||
// hsLogEntry(plNetObjectDebugger::GetInstance()->LogMsg(plString::Format("Dispatching SDL state, type %s to object:%s, locallyOwned=%d, st=%.3f rt=%.3f",
|
||||
// pl->fSDRec->GetDescriptor()->GetName().c_str(), pl->fKey->GetName().c_str(),
|
||||
// so->IsLocallyOwned()==plSynchedObject::kYes, secs, hsTimer::GetSeconds()).c_str()));
|
||||
// hsLogEntry( pl->fSDRec->DumpToObjectDebugger( "Delivering SDL state", false, 0 ) );
|
||||
}
|
||||
@ -671,7 +672,7 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs)
|
||||
// for around 5 minutes and its time to go
|
||||
|
||||
WarningMsg( "Pending state '%s' for object [uoid:%s,key:%s] has been queued for about %f secs. Removing...",
|
||||
pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName() : "?",
|
||||
pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName().c_str() : "?",
|
||||
pl->fUoid.StringIze().c_str(), pl->fKey ? pl->fKey->GetUoid().StringIze().c_str() : "?",
|
||||
( rawSecs - pl->fQueuedTime ) * pl->fQueueTimeResets);
|
||||
|
||||
@ -681,7 +682,7 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs)
|
||||
}
|
||||
|
||||
WarningMsg( "Pending state '%s' for object [uoid:%s,key:%s] has been queued for about %f secs. %s",
|
||||
pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName() : "?",
|
||||
pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName().c_str() : "?",
|
||||
pl->fUoid.StringIze().c_str(), pl->fKey ? pl->fKey->GetUoid().StringIze().c_str() : "?",
|
||||
( rawSecs - pl->fQueuedTime ) * pl->fQueueTimeResets,
|
||||
so ? "(not loaded)" : "(not final)" );
|
||||
|
@ -236,12 +236,12 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgSDLState)
|
||||
|
||||
// extract stateDataRecord from msg
|
||||
hsReadOnlyStream stream(m->StreamInfo()->GetStreamLen(), m->StreamInfo()->GetStreamBuf());
|
||||
char* descName = nil;
|
||||
plString descName;
|
||||
int ver;
|
||||
plStateDataRecord::ReadStreamHeader(&stream, &descName, &ver);
|
||||
plStateDescriptor* des = plSDLMgr::GetInstance()->FindDescriptor(descName, ver);
|
||||
|
||||
if (stricmp(descName, kSDLAvatarPhysical) == 0)
|
||||
if (descName.CompareI(kSDLAvatarPhysical) == 0)
|
||||
rwFlags |= plSDL::kKeepDirty;
|
||||
|
||||
//
|
||||
@ -287,13 +287,11 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgSDLState)
|
||||
// queue up state
|
||||
nc->fPendingLoads.push_back(pl);
|
||||
hsLogEntry( nc->DebugMsg( "Added pending SDL delivery for %s:%s",
|
||||
m->ObjectInfo()->GetObjectName().c_str(), des->GetName() ) );
|
||||
m->ObjectInfo()->GetObjectName().c_str(), des->GetName().c_str() ) );
|
||||
}
|
||||
else
|
||||
delete sdRec;
|
||||
|
||||
delete [] descName; // We've only used descName for a lookup (via SDR, and some error strings. Must delete now.
|
||||
|
||||
return hsOK;
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ void plNetLinkingMgr::IDoLink(plLinkToAgeMsg* msg)
|
||||
);
|
||||
StrCopy(
|
||||
joinAgeOp->age.spawnPtName,
|
||||
GetAgeLink()->SpawnPoint().GetName(),
|
||||
GetAgeLink()->SpawnPoint().GetName().c_str(),
|
||||
arrsize(joinAgeOp->age.spawnPtName)
|
||||
);
|
||||
QueueOp(joinAgeOp);
|
||||
|
@ -129,11 +129,11 @@ void plNetClientStatsRecorder::ILogMsg(plNetMessage* msg, const char* preText)
|
||||
else if (plNetMsgSDLState* sdlMsg = plNetMsgSDLState::ConvertNoRef(msg))
|
||||
{
|
||||
hsReadOnlyStream stream(sdlMsg->StreamInfo()->GetStreamLen(), sdlMsg->StreamInfo()->GetStreamBuf());
|
||||
char* descName=nil;
|
||||
plString descName;
|
||||
int ver;
|
||||
if (plStateDataRecord::ReadStreamHeader(&stream, &descName, &ver))
|
||||
{
|
||||
fLog->AddLineF("%s%s(%s)", preText, msg->ClassName(), descName);
|
||||
fLog->AddLineF("%s%s(%s)", preText, msg->ClassName(), descName.c_str());
|
||||
|
||||
int i;
|
||||
|
||||
@ -143,17 +143,16 @@ void plNetClientStatsRecorder::ILogMsg(plNetMessage* msg, const char* preText)
|
||||
sdRec.GetDirtyVars(&vars);
|
||||
for (i = 0; i < vars.size(); i++)
|
||||
{
|
||||
fLog->AddLineF("\t%s", vars[i]->GetVarDescriptor()->GetName());
|
||||
fLog->AddLineF("\t%s", vars[i]->GetVarDescriptor()->GetName().c_str());
|
||||
}
|
||||
|
||||
plStateDataRecord::SDVarsList sdVars;
|
||||
sdRec.GetDirtySDVars(&sdVars);
|
||||
for (i = 0; i < sdVars.size(); i++)
|
||||
{
|
||||
fLog->AddLineF("\t%s", sdVars[i]->GetSDVarDescriptor()->GetName());
|
||||
fLog->AddLineF("\t%s", sdVars[i]->GetSDVarDescriptor()->GetName().c_str());
|
||||
}
|
||||
}
|
||||
delete [] descName;
|
||||
}
|
||||
else
|
||||
fLog->AddLineF("%s%s", preText, msg->ClassName());
|
||||
|
@ -334,11 +334,11 @@ void plNetClientStreamRecorder::ILogMsg(plNetMessage* msg, const char* preText)
|
||||
else if (plNetMsgSDLState* sdlMsg = plNetMsgSDLState::ConvertNoRef(msg))
|
||||
{
|
||||
hsReadOnlyStream stream(sdlMsg->StreamInfo()->GetStreamLen(), sdlMsg->StreamInfo()->GetStreamBuf());
|
||||
char* descName=nil;
|
||||
plString descName;
|
||||
int ver;
|
||||
if (plStateDataRecord::ReadStreamHeader(&stream, &descName, &ver))
|
||||
{
|
||||
fLog->AddLineF("%s%s(%s)", preText, msg->ClassName(), descName);
|
||||
fLog->AddLineF("%s%s(%s)", preText, msg->ClassName(), descName.c_str());
|
||||
|
||||
int i;
|
||||
|
||||
@ -348,17 +348,16 @@ void plNetClientStreamRecorder::ILogMsg(plNetMessage* msg, const char* preText)
|
||||
sdRec.GetDirtyVars(&vars);
|
||||
for (i = 0; i < vars.size(); i++)
|
||||
{
|
||||
fLog->AddLineF("\t%s", vars[i]->GetVarDescriptor()->GetName());
|
||||
fLog->AddLineF("\t%s", vars[i]->GetVarDescriptor()->GetName().c_str());
|
||||
}
|
||||
|
||||
plStateDataRecord::SDVarsList sdVars;
|
||||
sdRec.GetDirtySDVars(&sdVars);
|
||||
for (i = 0; i < sdVars.size(); i++)
|
||||
{
|
||||
fLog->AddLineF("\t%s", sdVars[i]->GetSDVarDescriptor()->GetName());
|
||||
fLog->AddLineF("\t%s", sdVars[i]->GetSDVarDescriptor()->GetName().c_str());
|
||||
}
|
||||
}
|
||||
delete [] descName;
|
||||
}
|
||||
else
|
||||
fLog->AddLineF("%s%s", preText, msg->ClassName());
|
||||
|
@ -387,14 +387,14 @@ void plAgeLinkStruct::Read( hsStream * s, hsResMgr* m)
|
||||
s->LogReadLE( &fLinkingRules ,"LinkingRules");
|
||||
if ( IsFlagSet( kHasSpawnPt_DEAD ) )
|
||||
{
|
||||
std::string str;
|
||||
plString str;
|
||||
s->LogSubStreamPushDesc("SpawnPt_DEAD");
|
||||
plMsgStdStringHelper::Peek(str,s);
|
||||
fSpawnPoint.SetName( str.c_str() );
|
||||
if ( strcmp( fSpawnPoint.GetName(), kDefaultSpawnPtName )==0 )
|
||||
fSpawnPoint.SetName( str );
|
||||
if ( fSpawnPoint.GetName() == kDefaultSpawnPtName )
|
||||
fSpawnPoint.SetTitle( kDefaultSpawnPtTitle );
|
||||
else
|
||||
fSpawnPoint.SetTitle( str.c_str() );
|
||||
fSpawnPoint.SetTitle( str );
|
||||
ClearFlag( kHasSpawnPt_DEAD );
|
||||
SetFlag( kHasSpawnPt );
|
||||
}
|
||||
@ -520,7 +520,7 @@ plString plAgeLinkStruct::AsString() const
|
||||
{
|
||||
ss << spacer
|
||||
<< "Spwn:"
|
||||
<< fSpawnPoint.AsStdString().c_str();
|
||||
<< fSpawnPoint.AsString();
|
||||
spacer = kComma;
|
||||
}
|
||||
if (HasAmCCR())
|
||||
|
@ -120,10 +120,10 @@ void plSpawnPointInfo::Reset()
|
||||
(*this)=kDefaultSpawnPoint;
|
||||
}
|
||||
|
||||
std::string plSpawnPointInfo::AsStdString() const
|
||||
plString plSpawnPointInfo::AsString() const
|
||||
{
|
||||
return xtl::format( "t:%s,n:%s,c:%s",
|
||||
fTitle.size()?fTitle.c_str():"(nil)",
|
||||
fSpawnPt.size()?fSpawnPt.c_str():"(nil)",
|
||||
fCameraStack.size()?fCameraStack.c_str():"(nil)" );
|
||||
return plString::Format( "t:%s,n:%s,c:%s",
|
||||
fTitle.c_str("(nil)"),
|
||||
fSpawnPt.c_str("(nil)"),
|
||||
fCameraStack.c_str("(nil)") );
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define plSpawnPointInfo_h_inc
|
||||
|
||||
#include "hsStlUtils.h"
|
||||
#include "plString.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -55,24 +56,24 @@ class hsStream;
|
||||
|
||||
struct plSpawnPointInfo
|
||||
{
|
||||
std::string fTitle; // friendly title for GUIs
|
||||
std::string fSpawnPt; // name of spawn point in dataset
|
||||
std::string fCameraStack;
|
||||
plString fTitle; // friendly title for GUIs
|
||||
plString fSpawnPt; // name of spawn point in dataset
|
||||
plString fCameraStack;
|
||||
plSpawnPointInfo(){}
|
||||
plSpawnPointInfo( const plSpawnPointInfo & other ) { (*this)=other; }
|
||||
plSpawnPointInfo( const char * title, const char * spawnPt )
|
||||
plSpawnPointInfo( const plString & title, const plString & spawnPt )
|
||||
: fTitle( title ), fSpawnPt( spawnPt ) {}
|
||||
const char * GetTitle() const { return fTitle.c_str(); }
|
||||
void SetTitle( const char * v ) { fTitle=v; }
|
||||
const char * GetName() const { return fSpawnPt.c_str(); }
|
||||
void SetName( const char * v ) { fSpawnPt = v; }
|
||||
const char * GetCameraStack() const { return fCameraStack.c_str(); }
|
||||
void SetCameraStack( const char * v ) { fCameraStack=v; }
|
||||
plString GetTitle() const { return fTitle; }
|
||||
void SetTitle( const plString & v ) { fTitle=v; }
|
||||
plString GetName() const { return fSpawnPt; }
|
||||
void SetName( const plString & v ) { fSpawnPt = v; }
|
||||
plString GetCameraStack() const { return fCameraStack; }
|
||||
void SetCameraStack( const plString & v ) { fCameraStack=v; }
|
||||
void Reset();
|
||||
void Read( hsStream * s );
|
||||
void ReadOld( hsStream * s );
|
||||
void Write( hsStream * s ) const;
|
||||
std::string AsStdString() const;
|
||||
plString AsString() const;
|
||||
};
|
||||
typedef std::vector<plSpawnPointInfo> plSpawnPointVec;
|
||||
|
||||
|
@ -107,10 +107,10 @@ namespace plSDL
|
||||
class plStateVarNotificationInfo
|
||||
{
|
||||
private:
|
||||
std::string fHintString;
|
||||
plString fHintString;
|
||||
public:
|
||||
void SetHintString(const char* c) { fHintString=c; }
|
||||
const char* GetHintString() const { return fHintString.c_str(); }
|
||||
void SetHintString(const plString& c) { fHintString=c; }
|
||||
plString GetHintString() const { return fHintString; }
|
||||
|
||||
void Read(hsStream* s, uint32_t readOptions);
|
||||
void Write(hsStream* s, uint32_t writeOptions) const;
|
||||
@ -137,8 +137,8 @@ public:
|
||||
plStateVariable() : fFlags(0) {}
|
||||
virtual ~plStateVariable() {}
|
||||
|
||||
const char* GetName() const { return GetVarDescriptor()->GetName(); }
|
||||
bool IsNamed(const char* n) const { return (n && !stricmp(GetName(), n)); }
|
||||
plString GetName() const { return GetVarDescriptor()->GetName(); }
|
||||
bool IsNamed(const char* n) const { return (n && !GetName().CompareI(n)); }
|
||||
virtual int GetCount() const = 0;
|
||||
|
||||
// conversion ops
|
||||
@ -193,7 +193,7 @@ public:
|
||||
int RemoveNotificationKey(plKey k); // returns number of keys left after removal
|
||||
int RemoveNotificationKeys(KeyList keys); // returns number of keys left after removal
|
||||
|
||||
void SendNotificationMsg(const plSimpleStateVariable* srcVar, const plSimpleStateVariable* dstVar, const char* sdlName);
|
||||
void SendNotificationMsg(const plSimpleStateVariable* srcVar, const plSimpleStateVariable* dstVar, const plString& sdlName);
|
||||
|
||||
bool GetValue(float* i) const;
|
||||
bool SetValue(float i);
|
||||
@ -266,10 +266,10 @@ public:
|
||||
void TimeStamp( const plUnifiedTime & ut=plUnifiedTime::GetCurrentTime() );
|
||||
void CopyFrom(plVarDescriptor* v);
|
||||
void CopyData(const plSimpleStateVariable* other, uint32_t writeOptions=0);
|
||||
bool SetFromString(const char* value, int idx, bool timeStampNow); // set value from string, type. return false on err
|
||||
char* GetAsString(int idx) const;
|
||||
bool SetFromString(const plString& value, int idx, bool timeStampNow); // set value from string, type. return false on err
|
||||
plString GetAsString(int idx) const;
|
||||
bool ConvertTo(plSimpleVarDescriptor* toVar, bool force=false); // return false on err
|
||||
void Alloc(int cnt=-1 /* -1 means don't change count */); // alloc memory after setting type
|
||||
void Alloc(int cnt=-1 /* -1 means don't change count */); // alloc memory after setting type
|
||||
void Reset();
|
||||
|
||||
// setters
|
||||
@ -293,7 +293,7 @@ public:
|
||||
// getters
|
||||
bool Get(int* value, int idx=0) const;
|
||||
bool Get(short* value, int idx=0) const;
|
||||
bool Get(uint8_t* value, int idx=0) const; // returns uint8_t or uint8_tVector
|
||||
bool Get(uint8_t* value, int idx=0) const; // returns uint8_t or uint8_tVector
|
||||
bool Get(float* value, int idx=0) const; // returns float or floatVector
|
||||
bool Get(double* value, int idx=0) const; // returns double or doubleVector
|
||||
bool Get(bool* value, int idx=0) const;
|
||||
@ -315,7 +315,7 @@ public:
|
||||
void AddStateChangeNotification(plStateChangeNotifier& n);
|
||||
void RemoveStateChangeNotification(plKey notificationObj); // remove all with this key
|
||||
void RemoveStateChangeNotification(plStateChangeNotifier n); // remove ones which match
|
||||
void NotifyStateChange(const plSimpleStateVariable* other, const char* sdlName); // send notification msg if necessary, internal use
|
||||
void NotifyStateChange(const plSimpleStateVariable* other, const plString& sdlName); // send notification msg if necessary, internal use
|
||||
|
||||
void DumpToObjectDebugger(bool dirtyOnly, int level) const;
|
||||
void DumpToStream(hsStream* stream, bool dirtyOnly, int level) const;
|
||||
@ -407,18 +407,18 @@ protected:
|
||||
plUoid fAssocObject; // optional
|
||||
VarsList fVarsList; // list of variables
|
||||
VarsList fSDVarsList; // list of nested data records
|
||||
uint32_t fFlags;
|
||||
uint32_t fFlags;
|
||||
static const uint8_t kIOVersion; // I/O Version
|
||||
|
||||
void IDeleteVarsList(VarsList& vars);
|
||||
void IInitDescriptor(const char* name, int version); // or plSDL::kLatestVersion
|
||||
void IInitDescriptor(const plString& name, int version); // or plSDL::kLatestVersion
|
||||
void IInitDescriptor(const plStateDescriptor* sd);
|
||||
|
||||
void IReadHeader(hsStream* s);
|
||||
void IWriteHeader(hsStream* s) const;
|
||||
bool IConvertVar(plSimpleStateVariable* fromVar, plSimpleStateVariable* toVar, bool force);
|
||||
|
||||
plStateVariable* IFindVar(const VarsList& vars, const char* name) const;
|
||||
plStateVariable* IFindVar(const VarsList& vars, const plString& name) const;
|
||||
int IGetNumUsedVars(const VarsList& vars) const;
|
||||
int IGetUsedVars(const VarsList& varsOut, VarsList *varsIn) const; // build a list of vars that have data
|
||||
bool IHasUsedVars(const VarsList& vars) const;
|
||||
@ -430,7 +430,7 @@ public:
|
||||
CLASSNAME_REGISTER( plStateDataRecord );
|
||||
GETINTERFACE_ANY( plStateDataRecord, plCreatable);
|
||||
|
||||
plStateDataRecord(const char* sdName, int version=plSDL::kLatestVersion);
|
||||
plStateDataRecord(const plString& sdName, int version=plSDL::kLatestVersion);
|
||||
plStateDataRecord(plStateDescriptor* sd);
|
||||
plStateDataRecord(const plStateDataRecord &other, uint32_t writeOptions=0 ):fFlags(0) { CopyFrom(other, writeOptions); }
|
||||
plStateDataRecord():fFlags(0) {}
|
||||
@ -442,8 +442,8 @@ public:
|
||||
uint32_t GetFlags() const { return fFlags; }
|
||||
void SetFlags(uint32_t f) { fFlags =f; }
|
||||
|
||||
plSimpleStateVariable* FindVar(const char* name) const { return (plSimpleStateVariable*)IFindVar(fVarsList, name); }
|
||||
plSDStateVariable* FindSDVar(const char* name) const { return (plSDStateVariable*)IFindVar(fSDVarsList, name); }
|
||||
plSimpleStateVariable* FindVar(const plString& name) const { return (plSimpleStateVariable*)IFindVar(fVarsList, name); }
|
||||
plSDStateVariable* FindSDVar(const plString& name) const { return (plSDStateVariable*)IFindVar(fSDVarsList, name); }
|
||||
|
||||
plStateDataRecord& operator=(const plStateDataRecord& other) { CopyFrom(other); return *this; }
|
||||
void CopyFrom(const plStateDataRecord& other, uint32_t writeOptions=0);
|
||||
@ -479,7 +479,7 @@ public:
|
||||
bool HasDirtySDVars() const { return IHasDirtyVars(fSDVarsList); }
|
||||
|
||||
const plStateDescriptor* GetDescriptor() const { return fDescriptor; }
|
||||
void SetDescriptor(const char* sdName, int version);
|
||||
void SetDescriptor(const plString& sdName, int version);
|
||||
|
||||
plNetMsgSDLState* PrepNetMsg(float timeConvert, uint32_t writeOptions) const; // create/prep a net msg with this data
|
||||
|
||||
@ -498,7 +498,7 @@ public:
|
||||
bool Read(hsStream* s, float timeConvert, uint32_t readOptions=0);
|
||||
void Write(hsStream* s, float timeConvert, uint32_t writeOptions=0) const;
|
||||
|
||||
static bool ReadStreamHeader(hsStream* s, char** name, int* version, plUoid* objUoid=nil);
|
||||
static bool ReadStreamHeader(hsStream* s, plString* name, int* version, plUoid* objUoid=nil);
|
||||
void WriteStreamHeader(hsStream* s, plUoid* objUoid=nil) const;
|
||||
};
|
||||
|
||||
@ -543,7 +543,7 @@ public:
|
||||
~plSDLMgr();
|
||||
|
||||
static plSDLMgr* GetInstance();
|
||||
plStateDescriptor* FindDescriptor(const char* name, int version, const plSDL::DescriptorList * dl=nil) const; // version or kLatestVersion
|
||||
plStateDescriptor* FindDescriptor(const plString& name, int version, const plSDL::DescriptorList * dl=nil) const; // version or kLatestVersion
|
||||
|
||||
const plSDL::DescriptorList * GetDescriptors( void ) const { return &fDescriptors;}
|
||||
|
||||
|
@ -50,6 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include "hsStlUtils.h"
|
||||
#include "plString.h"
|
||||
|
||||
//
|
||||
// Describes a variable in a state descriptor.
|
||||
@ -98,17 +99,17 @@ public:
|
||||
kVariableLength = 0x4 // Var is defined as int foo[], so it's length is variable, starting at 0
|
||||
};
|
||||
protected:
|
||||
static const uint8_t kVersion; // for Read/Write format
|
||||
char* fDefault; // set by .sdl
|
||||
char* fName; // set by .sdl
|
||||
int fCount; // set by .sdl
|
||||
Type fType; // set by .sdl
|
||||
char* fTypeString; // string version of fType
|
||||
uint32_t fFlags;
|
||||
std::string fDisplayOptions; // set by .sdl
|
||||
static const uint8_t kVersion; // for Read/Write format
|
||||
plString fDefault; // set by .sdl
|
||||
plString fName; // set by .sdl
|
||||
int fCount; // set by .sdl
|
||||
Type fType; // set by .sdl
|
||||
plString fTypeString; // string version of fType
|
||||
uint32_t fFlags;
|
||||
plString fDisplayOptions; // set by .sdl
|
||||
public:
|
||||
plVarDescriptor();
|
||||
virtual ~plVarDescriptor();
|
||||
plVarDescriptor() : fCount(1), fType(kNone), fFlags(0) { }
|
||||
virtual ~plVarDescriptor() { }
|
||||
|
||||
virtual void CopyFrom(const plVarDescriptor* v);
|
||||
|
||||
@ -119,26 +120,26 @@ public:
|
||||
virtual const plSDVarDescriptor* GetAsSDVarDescriptor() const = 0;
|
||||
|
||||
// getters
|
||||
const char* GetDefault() const { return fDefault; }
|
||||
const char* GetName() const { return fName; }
|
||||
Type GetType() const { return fType; }
|
||||
const char* GetTypeString() const { return fTypeString; }
|
||||
int GetCount() const { return fCount; }
|
||||
bool IsInternal() const { return (fFlags & kInternal) != 0; }
|
||||
bool IsAlwaysNew() const { return (fFlags & kAlwaysNew) != 0; }
|
||||
bool IsVariableLength() const { return (fFlags & kVariableLength) != 0; }
|
||||
const char* GetDisplayOptions() const { return fDisplayOptions.c_str(); }
|
||||
plString GetDefault() const { return fDefault; }
|
||||
plString GetName() const { return fName; }
|
||||
Type GetType() const { return fType; }
|
||||
plString GetTypeString() const { return fTypeString; }
|
||||
int GetCount() const { return fCount; }
|
||||
bool IsInternal() const { return (fFlags & kInternal) != 0; }
|
||||
bool IsAlwaysNew() const { return (fFlags & kAlwaysNew) != 0; }
|
||||
bool IsVariableLength() const { return (fFlags & kVariableLength) != 0; }
|
||||
plString GetDisplayOptions() const { return fDisplayOptions; }
|
||||
|
||||
// setters
|
||||
void SetDefault(const char* n) { delete [] fDefault; fDefault= hsStrcpy(n); }
|
||||
void SetName(const char* n) { delete [] fName; fName = hsStrcpy(n); }
|
||||
void SetDefault(const plString& n) { fDefault = n; }
|
||||
void SetName(const plString& n) { fName = n; }
|
||||
void SetCount(int c) { fCount=c; }
|
||||
virtual bool SetType(const char* type);
|
||||
void SetType(Type t) { fType=t; }
|
||||
virtual bool SetType(const plString& type);
|
||||
void SetType(Type t) { fType=t; }
|
||||
void SetInternal(bool d) { if (d) fFlags |= kInternal; else fFlags &= ~kInternal; }
|
||||
void SetAlwaysNew(bool d) { if (d) fFlags |= kAlwaysNew; else fFlags &= ~kAlwaysNew; }
|
||||
void SetVariableLength(bool d) { if (d) fFlags |= kVariableLength; else fFlags &= ~kVariableLength; }
|
||||
void SetDisplayOptions(const char* s) { fDisplayOptions=s; }
|
||||
void SetDisplayOptions(const plString& s) { fDisplayOptions=s; }
|
||||
|
||||
// IO
|
||||
virtual bool Read(hsStream* s);
|
||||
@ -173,7 +174,7 @@ public:
|
||||
int GetAtomicCount() const { return fAtomicCount; }
|
||||
|
||||
// setters
|
||||
bool SetType(const char* type);
|
||||
bool SetType(const plString& type);
|
||||
void SetType(Type t) { plVarDescriptor::SetType(t); } // for lame compiler
|
||||
void SetAtomicType(Type t) { fAtomicType=t; }
|
||||
|
||||
@ -225,16 +226,16 @@ private:
|
||||
typedef std::vector<plVarDescriptor*> VarsList;
|
||||
VarsList fVarsList;
|
||||
int fVersion;
|
||||
char* fName;
|
||||
plString fName;
|
||||
std::string fFilename; // the filename this descriptor was read from
|
||||
|
||||
void IDeInit();
|
||||
public:
|
||||
plStateDescriptor() : fVersion(-1),fName(nil) {}
|
||||
plStateDescriptor() : fVersion(-1) {}
|
||||
~plStateDescriptor();
|
||||
|
||||
// getters
|
||||
const char* GetName() const { return fName; }
|
||||
plString GetName() const { return fName; }
|
||||
int GetNumVars() const { return fVarsList.size(); }
|
||||
plVarDescriptor* GetVar(int i) const { return fVarsList[i]; }
|
||||
int GetVersion() const { return fVersion; }
|
||||
@ -242,11 +243,11 @@ public:
|
||||
|
||||
// setters
|
||||
void SetVersion(int v) { fVersion=v; }
|
||||
void SetName(const char* n) { delete [] fName; fName=hsStrcpy(n); }
|
||||
void SetName(const plString& n) { fName=n; }
|
||||
void AddVar(plVarDescriptor* v) { fVarsList.push_back(v); }
|
||||
void SetFilename( const char * n ) { fFilename=n;}
|
||||
|
||||
plVarDescriptor* FindVar(const char* name, int* idx=nil) const;
|
||||
plVarDescriptor* FindVar(const plString& name, int* idx=nil) const;
|
||||
|
||||
// IO
|
||||
bool Read(hsStream* s);
|
||||
|
@ -101,9 +101,9 @@ plSDLMgr* plSDLMgr::GetInstance()
|
||||
// search latest and legacy descriptors for one that matches.
|
||||
// if version is -1, search for latest descriptor with matching name
|
||||
//
|
||||
plStateDescriptor* plSDLMgr::FindDescriptor(const char* name, int version, const plSDL::DescriptorList * dl) const
|
||||
plStateDescriptor* plSDLMgr::FindDescriptor(const plString& name, int version, const plSDL::DescriptorList * dl) const
|
||||
{
|
||||
if (!name)
|
||||
if (name.IsNull())
|
||||
return nil;
|
||||
|
||||
if ( !dl )
|
||||
@ -116,7 +116,7 @@ plStateDescriptor* plSDLMgr::FindDescriptor(const char* name, int version, const
|
||||
int highestFound = -1;
|
||||
for(it=(*dl).begin(); it!= (*dl).end(); it++)
|
||||
{
|
||||
if (!stricmp((*it)->GetName(), name) )
|
||||
if (!(*it)->GetName().CompareI(name) )
|
||||
{
|
||||
if ( (*it)->GetVersion()==version )
|
||||
{
|
||||
|
@ -162,12 +162,12 @@ bool plSDLParser::IParseStateDesc(const char* fileName, hsStream* stream, char t
|
||||
bool plSDLParser::IParseVarDesc(const char* fileName, hsStream* stream, char token[], plStateDescriptor*& curDesc,
|
||||
plVarDescriptor*& curVar) const
|
||||
{
|
||||
hsAssert(curDesc, xtl::format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
hsAssert(curDesc, plString::Format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
if ( !curDesc )
|
||||
return false;
|
||||
|
||||
bool skipNext=false;
|
||||
std::string dbgStr;
|
||||
plString dbgStr;
|
||||
static char seps[] = "( ,)[]";
|
||||
// read type, name, cnt, [default]
|
||||
|
||||
@ -180,7 +180,7 @@ bool plSDLParser::IParseVarDesc(const char* fileName, hsStream* stream, char tok
|
||||
// nested sdls
|
||||
char* sdlName = token+1;
|
||||
plStateDescriptor* stateDesc = plSDLMgr::GetInstance()->FindDescriptor(sdlName, plSDL::kLatestVersion);
|
||||
hsAssert(stateDesc, xtl::format("can't find nested state desc reference %s, fileName=%s",
|
||||
hsAssert(stateDesc, plString::Format("can't find nested state desc reference %s, fileName=%s",
|
||||
sdlName, fileName).c_str());
|
||||
curVar = new plSDVarDescriptor(stateDesc);
|
||||
}
|
||||
@ -189,19 +189,19 @@ bool plSDLParser::IParseVarDesc(const char* fileName, hsStream* stream, char tok
|
||||
|
||||
curDesc->AddVar(curVar);
|
||||
bool ok=curVar->SetType(token);
|
||||
hsAssert(ok, xtl::format("Variable 'type' syntax problem with .sdl file, type=%s, fileName=%s", token, fileName).c_str());
|
||||
dbgStr = xtl::format("\tVAR Type=%s ", token).c_str();
|
||||
hsAssert(ok, plString::Format("Variable 'type' syntax problem with .sdl file, type=%s, fileName=%s", token, fileName).c_str());
|
||||
dbgStr = plString::Format("\tVAR Type=%s ", token);
|
||||
|
||||
//
|
||||
// NAME (foo[1])
|
||||
//
|
||||
if (stream->GetToken(token, kTokenLen))
|
||||
{
|
||||
hsAssert(strstr(token, "[") && strstr(token, "]"), xtl::format("invalid var syntax, missing [x], fileName=%s",
|
||||
hsAssert(strstr(token, "[") && strstr(token, "]"), plString::Format("invalid var syntax, missing [x], fileName=%s",
|
||||
fileName).c_str());
|
||||
char* ptr = strtok( token, seps ); // skip [
|
||||
|
||||
hsAssert(curVar, xtl::format("Missing current var. Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
hsAssert(curVar, plString::Format("Missing current var. Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
curVar->SetName(token);
|
||||
//
|
||||
// COUNT
|
||||
@ -211,7 +211,7 @@ bool plSDLParser::IParseVarDesc(const char* fileName, hsStream* stream, char tok
|
||||
curVar->SetCount(cnt);
|
||||
if (cnt==0)
|
||||
curVar->SetVariableLength(true);
|
||||
dbgStr += xtl::format("Name=%s[%d]", curVar->GetName(), cnt).c_str();
|
||||
dbgStr += plString::Format("Name=%s[%d]", curVar->GetName().c_str(), cnt);
|
||||
}
|
||||
|
||||
//
|
||||
@ -221,10 +221,10 @@ bool plSDLParser::IParseVarDesc(const char* fileName, hsStream* stream, char tok
|
||||
{
|
||||
if (!strcmp(token, "DEFAULT"))
|
||||
{
|
||||
hsAssert(curVar, xtl::format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
hsAssert(curVar, plString::Format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
// read state var type
|
||||
|
||||
std::string defaultStr;
|
||||
plString defaultStr;
|
||||
plSimpleVarDescriptor* sVar=(plSimpleVarDescriptor*)curVar;
|
||||
if (sVar)
|
||||
{
|
||||
@ -239,51 +239,51 @@ bool plSDLParser::IParseVarDesc(const char* fileName, hsStream* stream, char tok
|
||||
}
|
||||
}
|
||||
}
|
||||
if (defaultStr.size())
|
||||
if (!defaultStr.IsEmpty())
|
||||
{
|
||||
curVar->SetDefault(defaultStr.c_str());
|
||||
dbgStr += std::string(" DEFAULT=") + defaultStr;
|
||||
curVar->SetDefault(defaultStr);
|
||||
dbgStr += " DEFAULT=" + defaultStr;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!strcmp(token, "DISPLAYOPTION"))
|
||||
{
|
||||
hsAssert(curVar, xtl::format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
dbgStr += std::string(" ") + token;
|
||||
hsAssert(curVar, plString::Format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
dbgStr += plString(" ") + token;
|
||||
|
||||
bool read=stream->GetToken(token, kTokenLen);
|
||||
if (read)
|
||||
{
|
||||
std::string oldOptions=curVar->GetDisplayOptions();
|
||||
if (oldOptions.size())
|
||||
oldOptions += std::string(",");
|
||||
plString oldOptions=curVar->GetDisplayOptions();
|
||||
if (!oldOptions.IsEmpty())
|
||||
oldOptions += ",";
|
||||
oldOptions += token;
|
||||
curVar->SetDisplayOptions(oldOptions.c_str());
|
||||
dbgStr += std::string("=") + token;
|
||||
curVar->SetDisplayOptions(oldOptions);
|
||||
dbgStr += plString("=") + token;
|
||||
if (!stricmp(token, "hidden"))
|
||||
curVar->SetInternal(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
hsAssert(false, xtl::format("missing displayOption string, fileName=%s", fileName).c_str());
|
||||
hsAssert(false, plString::Format("missing displayOption string, fileName=%s", fileName).c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!strcmp(token, "DEFAULTOPTION"))
|
||||
{
|
||||
hsAssert(curVar, xtl::format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
dbgStr += std::string(" ") + token;
|
||||
hsAssert(curVar, plString::Format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
dbgStr += plString(" ") + token;
|
||||
|
||||
bool read=stream->GetToken(token, kTokenLen);
|
||||
if (read)
|
||||
{
|
||||
dbgStr += std::string("=") + token;
|
||||
dbgStr += plString("=") + token;
|
||||
if (!stricmp(token, "vault"))
|
||||
curVar->SetAlwaysNew(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
hsAssert(false, xtl::format("missing defaultOption string, fileName=%s", fileName).c_str());
|
||||
hsAssert(false, plString::Format("missing defaultOption string, fileName=%s", fileName).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,16 +291,16 @@ bool plSDLParser::IParseVarDesc(const char* fileName, hsStream* stream, char tok
|
||||
else
|
||||
if (!strcmp(token, "INTERNAL"))
|
||||
{
|
||||
hsAssert(curVar, xtl::format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
hsAssert(curVar, plString::Format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
curVar->SetInternal(true);
|
||||
dbgStr += std::string(" ") + token;
|
||||
dbgStr += plString(" ") + token;
|
||||
}
|
||||
else
|
||||
if (!strcmp(token, "PHASED"))
|
||||
{
|
||||
hsAssert(curVar, xtl::format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
hsAssert(curVar, plString::Format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
|
||||
curVar->SetAlwaysNew(true);
|
||||
dbgStr += std::string(" ") + token;
|
||||
dbgStr += plString(" ") + token;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
|
@ -121,7 +121,7 @@ bool plStateChangeNotifier::operator==(const plStateChangeNotifier &other) const
|
||||
// send notification msg to all registered recipients
|
||||
//
|
||||
void plStateChangeNotifier::SendNotificationMsg(const plSimpleStateVariable* srcVar, const plSimpleStateVariable* dstVar,
|
||||
const char* sdlName)
|
||||
const plString& sdlName)
|
||||
{
|
||||
plSDLNotificationMsg* m = new plSDLNotificationMsg;
|
||||
|
||||
|
@ -95,7 +95,7 @@ void plSDL::VariableLengthWrite(hsStream* s, int size, int val)
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// State Data
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
plStateDataRecord::plStateDataRecord(const char* name, int version) : fFlags(0)
|
||||
plStateDataRecord::plStateDataRecord(const plString& name, int version) : fFlags(0)
|
||||
, fDescriptor( nil )
|
||||
{
|
||||
SetDescriptor(name, version);
|
||||
@ -113,7 +113,7 @@ plStateDataRecord::~plStateDataRecord()
|
||||
IDeleteVarsList(fSDVarsList);
|
||||
}
|
||||
|
||||
void plStateDataRecord::SetDescriptor(const char* name, int version)
|
||||
void plStateDataRecord::SetDescriptor(const plString& name, int version)
|
||||
{
|
||||
IInitDescriptor(name, version);
|
||||
}
|
||||
@ -125,10 +125,10 @@ void plStateDataRecord::IDeleteVarsList(VarsList& vars)
|
||||
vars.clear();
|
||||
}
|
||||
|
||||
void plStateDataRecord::IInitDescriptor(const char* name, int version)
|
||||
void plStateDataRecord::IInitDescriptor(const plString& name, int version)
|
||||
{
|
||||
plStateDescriptor* sd = plSDLMgr::GetInstance()->FindDescriptor(name, version);
|
||||
//hsAssert( sd, xtl::format("Failed to find sdl descriptor: %s,%d. Missing legacy descriptor?", name, version ).c_str() );
|
||||
//hsAssert( sd, plString::Format("Failed to find sdl descriptor: %s,%d. Missing legacy descriptor?", name.c_str(), version ).c_str() );
|
||||
if (sd)
|
||||
IInitDescriptor(sd);
|
||||
}
|
||||
@ -268,7 +268,7 @@ bool plStateDataRecord::Read(hsStream* s, float timeConvert, uint32_t readOption
|
||||
{
|
||||
if (plSDLMgr::GetInstance()->GetNetApp())
|
||||
plSDLMgr::GetInstance()->GetNetApp()->ErrorMsg("Failed reading SDL, desc %s",
|
||||
fDescriptor && fDescriptor->GetName() ? fDescriptor->GetName() : "?");
|
||||
fDescriptor ? fDescriptor->GetName().c_str("?") : "?");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -276,8 +276,8 @@ bool plStateDataRecord::Read(hsStream* s, float timeConvert, uint32_t readOption
|
||||
catch(...)
|
||||
{
|
||||
hsAssert( false,
|
||||
xtl::format("Something bad happened while reading simple var data, desc:%s",
|
||||
fDescriptor && fDescriptor->GetName() ? fDescriptor->GetName() : "?").c_str());
|
||||
plString::Format("Something bad happened while reading simple var data, desc:%s",
|
||||
fDescriptor ? fDescriptor->GetName().c_str("?") : "?").c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ bool plStateDataRecord::Read(hsStream* s, float timeConvert, uint32_t readOption
|
||||
{
|
||||
if (plSDLMgr::GetInstance()->GetNetApp())
|
||||
plSDLMgr::GetInstance()->GetNetApp()->ErrorMsg("Failed reading nested SDL, desc %s",
|
||||
fDescriptor && fDescriptor->GetName() ? fDescriptor->GetName() : "?");
|
||||
fDescriptor ? fDescriptor->GetName().c_str("?") : "?");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -310,15 +310,15 @@ bool plStateDataRecord::Read(hsStream* s, float timeConvert, uint32_t readOption
|
||||
catch(...)
|
||||
{
|
||||
hsAssert( false,
|
||||
xtl::format("Something bad happened while reading nested var data, desc:%s",
|
||||
fDescriptor && fDescriptor->GetName() ? fDescriptor->GetName() : "?").c_str());
|
||||
plString::Format("Something bad happened while reading nested var data, desc:%s",
|
||||
fDescriptor ? fDescriptor->GetName().c_str("?") : "?").c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert to latest descriptor
|
||||
// Only really need to do this the first time this descriptor is read...
|
||||
plStateDescriptor* latestDesc=plSDLMgr::GetInstance()->FindDescriptor(fDescriptor->GetName(), plSDL::kLatestVersion);
|
||||
hsAssert( latestDesc, xtl::format("Failed to find latest sdl descriptor for: %s", fDescriptor->GetName() ).c_str() );
|
||||
hsAssert( latestDesc, plString::Format("Failed to find latest sdl descriptor for: %s", fDescriptor->GetName().c_str() ).c_str() );
|
||||
bool forceConvert = (readOptions&plSDL::kForceConvert)!=0;
|
||||
if ( latestDesc && ( forceConvert || ( fDescriptor->GetVersion()!=latestDesc->GetVersion() ) ) )
|
||||
{
|
||||
@ -392,17 +392,17 @@ void plStateDataRecord::Write(hsStream* s, float timeConvert, uint32_t writeOpti
|
||||
//
|
||||
// STATIC - read prefix header. returns true on success
|
||||
//
|
||||
bool plStateDataRecord::ReadStreamHeader(hsStream* s, char** name, int* version, plUoid* objUoid)
|
||||
bool plStateDataRecord::ReadStreamHeader(hsStream* s, plString* name, int* version, plUoid* objUoid)
|
||||
{
|
||||
uint16_t savFlags;
|
||||
s->ReadLE(&savFlags);
|
||||
if (!(savFlags & plSDL::kAddedVarLengthIO)) // using to establish a new version in the header, can delete in 8/03
|
||||
{
|
||||
*name = nil;
|
||||
*name = "";
|
||||
return false; // bad version
|
||||
}
|
||||
|
||||
*name = s->ReadSafeString();
|
||||
*name = s->ReadSafeString_TEMP();
|
||||
*version = s->ReadLE16();
|
||||
|
||||
if (objUoid)
|
||||
@ -492,13 +492,14 @@ void plStateDataRecord::UpdateFrom(const plStateDataRecord& other, uint32_t writ
|
||||
if ( GetDescriptor()->GetVersion()!=other.GetDescriptor()->GetVersion() )
|
||||
{
|
||||
plStateDescriptor* sd=plSDLMgr::GetInstance()->FindDescriptor( other.GetDescriptor()->GetName(), other.GetDescriptor()->GetVersion() );
|
||||
hsAssert( sd, xtl::format( "Failed to find sdl descriptor %s,%d. Missing legacy descriptor?", other.GetDescriptor()->GetName(), other.GetDescriptor()->GetVersion() ).c_str() );
|
||||
hsAssert( sd, plString::Format( "Failed to find sdl descriptor %s,%d. Missing legacy descriptor?",
|
||||
other.GetDescriptor()->GetName().c_str(), other.GetDescriptor()->GetVersion() ).c_str() );
|
||||
ConvertTo( sd );
|
||||
}
|
||||
|
||||
hsAssert(other.GetDescriptor()==fDescriptor,
|
||||
xtl::format("descriptor mismatch in UpdateFromDirty, SDL=%s,%s version %d %d",
|
||||
GetDescriptor()->GetName(), other.GetDescriptor()->GetName(),
|
||||
plString::Format("descriptor mismatch in UpdateFromDirty, SDL=%s,%s version %d %d",
|
||||
GetDescriptor()->GetName().c_str(), other.GetDescriptor()->GetName().c_str(),
|
||||
GetDescriptor()->GetVersion(), other.GetDescriptor()->GetVersion()).c_str());
|
||||
|
||||
bool dirtyOnly = (writeOptions & plSDL::kDirtyOnly);
|
||||
@ -543,9 +544,9 @@ void plStateDataRecord::FlagDifferentState(const plStateDataRecord& other)
|
||||
}
|
||||
else
|
||||
{
|
||||
hsAssert(false, xtl::format("descriptor mismatch in FlagDifferentState, mine %s %d, other %s %d",
|
||||
fDescriptor->GetName(), fDescriptor->GetVersion(),
|
||||
other.GetDescriptor()->GetName(), other.GetDescriptor()->GetVersion()).c_str());
|
||||
hsAssert(false, plString::Format("descriptor mismatch in FlagDifferentState, mine %s %d, other %s %d",
|
||||
fDescriptor->GetName().c_str(), fDescriptor->GetVersion(),
|
||||
other.GetDescriptor()->GetName().c_str(), other.GetDescriptor()->GetVersion()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -597,9 +598,9 @@ void plStateDataRecord::FlagNewerState(const plStateDataRecord& other, bool resp
|
||||
}
|
||||
else
|
||||
{
|
||||
hsAssert(false, xtl::format("descriptor mismatch in FlagNewerState, mine %s %d, other %s %d",
|
||||
fDescriptor->GetName(), fDescriptor->GetVersion(),
|
||||
other.GetDescriptor()->GetName(), other.GetDescriptor()->GetVersion()).c_str());
|
||||
hsAssert(false, plString::Format("descriptor mismatch in FlagNewerState, mine %s %d, other %s %d",
|
||||
fDescriptor->GetName().c_str(), fDescriptor->GetVersion(),
|
||||
other.GetDescriptor()->GetName().c_str(), other.GetDescriptor()->GetVersion()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -651,16 +652,16 @@ bool plStateDataRecord::IConvertVar(plSimpleStateVariable* fromVar, plSimpleStat
|
||||
return true; // ok
|
||||
}
|
||||
|
||||
plStateVariable* plStateDataRecord::IFindVar(const VarsList& vars, const char* name) const
|
||||
plStateVariable* plStateDataRecord::IFindVar(const VarsList& vars, const plString& name) const
|
||||
{
|
||||
for (int i = 0; i < vars.size(); i++)
|
||||
{
|
||||
if (!stricmp(vars[i]->GetVarDescriptor()->GetName(), name))
|
||||
if (!vars[i]->GetVarDescriptor()->GetName().CompareI(name))
|
||||
return vars[i];
|
||||
}
|
||||
|
||||
if (plSDLMgr::GetInstance()->GetNetApp())
|
||||
plSDLMgr::GetInstance()->GetNetApp()->ErrorMsg("Failed to find SDL var %s", name);
|
||||
plSDLMgr::GetInstance()->GetNetApp()->ErrorMsg("Failed to find SDL var %s", name.c_str());
|
||||
|
||||
return nil;
|
||||
}
|
||||
@ -674,7 +675,7 @@ bool plStateDataRecord::ConvertTo( plStateDescriptor* other, bool force )
|
||||
if (!other && !force)
|
||||
return false; // err
|
||||
|
||||
hsAssert(!stricmp(fDescriptor->GetName(), other->GetName()), "descriptor mismatch");
|
||||
hsAssert(!fDescriptor->GetName().CompareI(other->GetName()), "descriptor mismatch");
|
||||
|
||||
if ( !force && (other == fDescriptor || other->GetVersion()==fDescriptor->GetVersion()))
|
||||
return true; // ok, nothing to do
|
||||
@ -682,7 +683,7 @@ bool plStateDataRecord::ConvertTo( plStateDescriptor* other, bool force )
|
||||
hsAssert(other->GetVersion()>=fDescriptor->GetVersion(), "converting to an older state descriptor version?");
|
||||
|
||||
hsLogEntry( plNetApp::StaticDebugMsg( "SDR(%p) converting sdl record %s from version %d to %d (force:%d)",
|
||||
this, fDescriptor->GetName(), fDescriptor->GetVersion(), other->GetVersion(), force ) );
|
||||
this, fDescriptor->GetName().c_str(), fDescriptor->GetVersion(), other->GetVersion(), force ) );
|
||||
|
||||
// make other StateData to represent other descriptor,
|
||||
// this will be the destination for the convert operation
|
||||
@ -696,7 +697,7 @@ bool plStateDataRecord::ConvertTo( plStateDescriptor* other, bool force )
|
||||
{
|
||||
// get other var info
|
||||
plSimpleStateVariable* otherVar = otherStateData.GetVar(i);
|
||||
const char* otherVarName = otherVar->GetVarDescriptor()->GetName();
|
||||
plString otherVarName = otherVar->GetVarDescriptor()->GetName();
|
||||
|
||||
// find corresponding var in my data
|
||||
plSimpleStateVariable* myVar=FindVar(otherVarName);
|
||||
@ -708,7 +709,7 @@ bool plStateDataRecord::ConvertTo( plStateDescriptor* other, bool force )
|
||||
for(i=0;i<otherStateData.GetNumSDVars(); i++)
|
||||
{
|
||||
plSDStateVariable* otherSDVar = otherStateData.GetSDVar(i);
|
||||
const char* otherSDVarName = otherSDVar->GetVarDescriptor()->GetName();
|
||||
plString otherSDVarName = otherSDVar->GetVarDescriptor()->GetName();
|
||||
|
||||
// find corresponding var in my data
|
||||
plSDStateVariable* mySDVar=FindSDVar(otherSDVarName);
|
||||
@ -747,7 +748,7 @@ void plStateDataRecord::DumpToObjectDebugger(const char* msg, bool dirtyOnly, in
|
||||
dbg->LogMsg(plString::Format("%s%s", pad.c_str(),msg).c_str());
|
||||
|
||||
dbg->LogMsg(plString::Format("%sSDR(%p), desc=%s, showDirty=%d, numVars=%d, vol=%d",
|
||||
pad.c_str(), this, fDescriptor->GetName(), dirtyOnly, numVars+numSDVars, fFlags&kVolatile).c_str());
|
||||
pad.c_str(), this, fDescriptor->GetName().c_str(), dirtyOnly, numVars+numSDVars, fFlags&kVolatile).c_str());
|
||||
|
||||
// dump simple vars
|
||||
for(i=0;i<fVarsList.size(); i++)
|
||||
@ -787,7 +788,8 @@ void plStateDataRecord::DumpToStream(hsStream* stream, const char* msg, bool dir
|
||||
stream->Write(logStr.GetSize(), logStr.c_str());
|
||||
}
|
||||
|
||||
logStr = plString::Format("%sSDR(%p), desc=%s, showDirty=%d, numVars=%d, vol=%d", pad.c_str(), this, fDescriptor->GetName(), dirtyOnly, numVars+numSDVars, fFlags&kVolatile);
|
||||
logStr = plString::Format("%sSDR(%p), desc=%s, showDirty=%d, numVars=%d, vol=%d",
|
||||
pad.c_str(), this, fDescriptor->GetName().c_str(), dirtyOnly, numVars+numSDVars, fFlags&kVolatile);
|
||||
stream->Write(logStr.GetSize(), logStr.c_str());
|
||||
|
||||
// dump simple vars
|
||||
|
@ -56,19 +56,18 @@ plStateDescriptor::~plStateDescriptor()
|
||||
|
||||
void plStateDescriptor::IDeInit()
|
||||
{
|
||||
delete [] fName;
|
||||
int i;
|
||||
for(i=0;i<fVarsList.size();i++)
|
||||
delete fVarsList[i];
|
||||
fVarsList.clear();
|
||||
}
|
||||
|
||||
plVarDescriptor* plStateDescriptor::FindVar(const char* name, int* idx) const
|
||||
plVarDescriptor* plStateDescriptor::FindVar(const plString& name, int* idx) const
|
||||
{
|
||||
VarsList::const_iterator it;
|
||||
for(it=fVarsList.begin(); it != fVarsList.end(); it++)
|
||||
{
|
||||
if (!stricmp((*it)->GetName(), name))
|
||||
if (!(*it)->GetName().CompareI(name))
|
||||
{
|
||||
if (idx)
|
||||
*idx = it-fVarsList.begin();
|
||||
@ -94,9 +93,8 @@ bool plStateDescriptor::Read(hsStream* s)
|
||||
}
|
||||
|
||||
IDeInit();
|
||||
|
||||
delete [] fName;
|
||||
fName = s->ReadSafeString();
|
||||
|
||||
fName = s->ReadSafeString_TEMP();
|
||||
|
||||
uint16_t version=s->ReadLE16();
|
||||
fVersion=version;
|
||||
|
@ -108,11 +108,9 @@ public:
|
||||
void plStateVarNotificationInfo::Read(hsStream* s, uint32_t readOptions)
|
||||
{
|
||||
uint8_t saveFlags=s->ReadByte(); // unused
|
||||
char* hint=s->ReadSafeString();
|
||||
if (hint && !(readOptions & plSDL::kSkipNotificationInfo))
|
||||
fHintString = (const char*)hint;
|
||||
// we're done with it...
|
||||
delete[] hint;
|
||||
plString hint=s->ReadSafeString_TEMP();
|
||||
if (!hint.IsNull() && !(readOptions & plSDL::kSkipNotificationInfo))
|
||||
fHintString = hint;
|
||||
}
|
||||
|
||||
void plStateVarNotificationInfo::Write(hsStream* s, uint32_t writeOptions) const
|
||||
@ -212,8 +210,8 @@ void plSimpleStateVariable::IDeAlloc()
|
||||
}
|
||||
break;
|
||||
default:
|
||||
hsAssert(false, xtl::format("undefined atomic type:%d var:%s cnt:%d",
|
||||
type, GetName() ? GetName() : "?", GetCount()).c_str());
|
||||
hsAssert(false, plString::Format("undefined atomic type:%d var:%s cnt:%d",
|
||||
type, GetName().c_str("?"), GetCount()).c_str());
|
||||
break;
|
||||
};
|
||||
|
||||
@ -328,12 +326,11 @@ void plSimpleStateVariable::TimeStamp( const plUnifiedTime & ut/*=plUnifiedTime:
|
||||
//
|
||||
// Set value from string. Used to set default values which are specified as strings.
|
||||
//
|
||||
bool plSimpleStateVariable::SetFromString(const char* valueConst, int idx, bool timeStampNow)
|
||||
bool plSimpleStateVariable::SetFromString(const plString& value, int idx, bool timeStampNow)
|
||||
{
|
||||
if (!valueConst)
|
||||
if (value.IsNull())
|
||||
return false;
|
||||
|
||||
std::string value = valueConst;
|
||||
plVarDescriptor::Type type=fVar.GetAtomicType();
|
||||
switch(type)
|
||||
{
|
||||
@ -346,54 +343,47 @@ bool plSimpleStateVariable::SetFromString(const char* valueConst, int idx, bool
|
||||
case plVarDescriptor::kByte:
|
||||
{
|
||||
// handles value in the form "(i,j,k)" for vectors
|
||||
static char seps[] = "( ,)";
|
||||
char* ptr = strtok( (char*)value.c_str(), seps );
|
||||
std::vector<plString> bits = value.Tokenize("( ,)");
|
||||
int i=idx*fVar.GetAtomicCount();
|
||||
while (ptr)
|
||||
for (std::vector<plString>::iterator ptr = bits.begin(); ptr != bits.end(); ++ptr)
|
||||
{
|
||||
if ((type==plVarDescriptor::kInt) && fI)
|
||||
fI[i++] = atoi(ptr);
|
||||
fI[i++] = ptr->ToInt();
|
||||
else if (type==plVarDescriptor::kShort && fS)
|
||||
fS[i++] = (short)atoi(ptr);
|
||||
fS[i++] = static_cast<short>(ptr->ToInt());
|
||||
else if (type==plVarDescriptor::kByte && fBy)
|
||||
fBy[i++] = (uint8_t)atoi(ptr);
|
||||
fBy[i++] = static_cast<uint8_t>(ptr->ToInt());
|
||||
else if ( (type==plVarDescriptor::kFloat || type==plVarDescriptor::kAgeTimeOfDay) && fF)
|
||||
fF[i++] = (float)atof(ptr);
|
||||
fF[i++] = static_cast<float>(ptr->ToFloat());
|
||||
else if ( (type==plVarDescriptor::kDouble || type==plVarDescriptor::kTime) && fD)
|
||||
fD[i++] = atof(ptr);
|
||||
ptr = strtok(nil, seps);
|
||||
fD[i++] = ptr->ToDouble();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case plVarDescriptor::kBool:
|
||||
{
|
||||
// handles value in the form "(i,j,k)" for things like vectors
|
||||
static char seps[] = "( ,)";
|
||||
char* ptr = strtok( (char*)value.c_str(), seps );
|
||||
std::vector<plString> bits = value.Tokenize("( ,)");
|
||||
int i=idx*fVar.GetAtomicCount();
|
||||
while (ptr)
|
||||
for (std::vector<plString>::iterator ptr = bits.begin(); ptr != bits.end(); ++ptr)
|
||||
{
|
||||
if (!stricmp(ptr, "true"))
|
||||
if (!ptr->CompareI("true"))
|
||||
fB[i++]=true;
|
||||
else
|
||||
if (!stricmp(ptr, "false"))
|
||||
else if (!ptr->CompareI("false"))
|
||||
fB[i++]=false;
|
||||
else
|
||||
fB[i++] = (atoi(ptr) != 0);
|
||||
ptr = strtok(nil, seps);
|
||||
fB[i++] = (ptr->ToInt() != 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case plVarDescriptor::kString32:
|
||||
{
|
||||
// handles value in the form "(i,j,k)" for things like vectors
|
||||
static char seps[] = "( ,)";
|
||||
char* ptr = strtok( (char*)value.c_str(), seps );
|
||||
std::vector<plString> bits = value.Tokenize("( ,)");
|
||||
int i=idx*fVar.GetAtomicCount();
|
||||
while (ptr)
|
||||
for (std::vector<plString>::iterator ptr = bits.begin(); ptr != bits.end(); ++ptr)
|
||||
{
|
||||
hsStrncpy(fS32[i++], ptr, 32);
|
||||
ptr = strtok(nil, seps);
|
||||
hsStrncpy(fS32[i++], ptr->c_str(), 32);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -419,12 +409,12 @@ void plSimpleStateVariable::IVarSet(bool timeStampNow/*=true*/)
|
||||
//
|
||||
// Get value as string.
|
||||
//
|
||||
char* plSimpleStateVariable::GetAsString(int idx) const
|
||||
plString plSimpleStateVariable::GetAsString(int idx) const
|
||||
{
|
||||
int j;
|
||||
std::string str;
|
||||
plString str;
|
||||
if (fVar.GetAtomicCount()>1)
|
||||
str = str + "(";
|
||||
str += "(";
|
||||
|
||||
plVarDescriptor::Type type=fVar.GetAtomicType();
|
||||
switch(type)
|
||||
@ -442,20 +432,20 @@ char* plSimpleStateVariable::GetAsString(int idx) const
|
||||
for(j=0;j<fVar.GetAtomicCount();j++)
|
||||
{
|
||||
if (type==plVarDescriptor::kInt)
|
||||
str.append( xtl::format( "%d", fI[i++]) );
|
||||
str += plString::Format( "%d", fI[i++]);
|
||||
else if (type==plVarDescriptor::kShort)
|
||||
str.append( xtl::format( "%d", fS[i++]) );
|
||||
str += plString::Format( "%d", fS[i++]);
|
||||
else if (type==plVarDescriptor::kByte)
|
||||
str.append( xtl::format( "%d", fBy[i++]) );
|
||||
str += plString::Format( "%d", fBy[i++]);
|
||||
else if (type==plVarDescriptor::kFloat || type==plVarDescriptor::kAgeTimeOfDay)
|
||||
str.append( xtl::format( "%.3f", fF[i++]) );
|
||||
str += plString::Format( "%.3f", fF[i++]);
|
||||
else if (type==plVarDescriptor::kDouble)
|
||||
str.append( xtl::format( "%.3f", fD[i++]) );
|
||||
str += plString::Format( "%.3f", fD[i++]);
|
||||
else if (type==plVarDescriptor::kTime)
|
||||
{
|
||||
double tmp;
|
||||
Get(&tmp, i++);
|
||||
str.append( xtl::format( "%.3f", tmp) );
|
||||
str += plString::Format( "%.3f", tmp);
|
||||
}
|
||||
|
||||
if (j==fVar.GetAtomicCount()-1)
|
||||
@ -474,7 +464,7 @@ char* plSimpleStateVariable::GetAsString(int idx) const
|
||||
int i=idx*fVar.GetAtomicCount();
|
||||
for(j=0;j<fVar.GetAtomicCount();j++)
|
||||
{
|
||||
str.append( xtl::format( "%s", fB[i++] ? "true" : "false") );
|
||||
str += plString::Format( "%s", fB[i++] ? "true" : "false");
|
||||
|
||||
if (j==fVar.GetAtomicCount()-1)
|
||||
{
|
||||
@ -492,7 +482,7 @@ char* plSimpleStateVariable::GetAsString(int idx) const
|
||||
int i=idx*fVar.GetAtomicCount();
|
||||
for(j=0;j<fVar.GetAtomicCount();j++)
|
||||
{
|
||||
str.append( xtl::format( "%s", fS32[i++]) );
|
||||
str += plString::Format( "%s", fS32[i++]);
|
||||
|
||||
if (j==fVar.GetAtomicCount()-1)
|
||||
{
|
||||
@ -510,7 +500,7 @@ char* plSimpleStateVariable::GetAsString(int idx) const
|
||||
int i=idx*fVar.GetAtomicCount();
|
||||
for(j=0;j<fVar.GetAtomicCount();j++)
|
||||
{
|
||||
str.append( xtl::format( "%s", "other") );
|
||||
str += "other";
|
||||
|
||||
if (j==fVar.GetAtomicCount()-1)
|
||||
{
|
||||
@ -524,7 +514,7 @@ char* plSimpleStateVariable::GetAsString(int idx) const
|
||||
break;
|
||||
}
|
||||
|
||||
return hsStrcpy(str.c_str());
|
||||
return str;
|
||||
}
|
||||
|
||||
//
|
||||
@ -2131,7 +2121,7 @@ case type: \
|
||||
} \
|
||||
break;
|
||||
|
||||
void plSimpleStateVariable::NotifyStateChange(const plSimpleStateVariable* other, const char* sdlName)
|
||||
void plSimpleStateVariable::NotifyStateChange(const plSimpleStateVariable* other, const plString& sdlName)
|
||||
{
|
||||
if (fChangeNotifiers.size()==0)
|
||||
return;
|
||||
@ -2174,8 +2164,8 @@ void plSimpleStateVariable::NotifyStateChange(const plSimpleStateVariable* other
|
||||
if (plNetObjectDebuggerBase::GetInstance() && plNetObjectDebuggerBase::GetInstance()->GetDebugging())
|
||||
{
|
||||
plNetObjectDebuggerBase::GetInstance()->LogMsg(
|
||||
xtl::format("Var %s did %s send notification difference. Has %d notifiers with %d recipients.",
|
||||
GetName(), !notify ? "NOT" : "", fChangeNotifiers.size(), numNotifiers).c_str());
|
||||
plString::Format("Var %s did %s send notification difference. Has %d notifiers with %d recipients.",
|
||||
GetName().c_str(), !notify ? "NOT" : "", fChangeNotifiers.size(), numNotifiers).c_str());
|
||||
}
|
||||
|
||||
}
|
||||
@ -2290,12 +2280,12 @@ void plSimpleStateVariable::DumpToObjectDebugger(bool dirtyOnly, int level) cons
|
||||
if (!dbg)
|
||||
return;
|
||||
|
||||
std::string pad;
|
||||
plString pad;
|
||||
int i;
|
||||
for(i=0;i<level; i++)
|
||||
pad += " ";
|
||||
|
||||
std::string logMsg = xtl::format( "%sSimpleVar, name:%s[%d]", pad.c_str(), GetName(), GetCount());
|
||||
plString logMsg = plString::Format( "%sSimpleVar, name:%s[%d]", pad.c_str(), GetName().c_str(), GetCount());
|
||||
if (GetCount()>1)
|
||||
{
|
||||
dbg->LogMsg(logMsg.c_str()); // it's going to be a long msg, so print it on its own line
|
||||
@ -2305,22 +2295,21 @@ void plSimpleStateVariable::DumpToObjectDebugger(bool dirtyOnly, int level) cons
|
||||
pad += "\t";
|
||||
for(i=0;i<GetCount(); i++)
|
||||
{
|
||||
char* s=GetAsString(i);
|
||||
plString s=GetAsString(i);
|
||||
if (fVar.GetAtomicType() == plVarDescriptor::kTime)
|
||||
{
|
||||
const char* p=fT[i].PrintWMillis();
|
||||
logMsg += xtl::format( "%sVar:%d gameTime:%s pst:%s ts:%s",
|
||||
pad.c_str(), i, s ? s : "?", p, fTimeStamp.Format("%c").c_str() );
|
||||
logMsg += plString::Format( "%sVar:%d gameTime:%s pst:%s ts:%s",
|
||||
pad.c_str(), i, s.c_str("?"), p, fTimeStamp.Format("%c").c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
logMsg +=xtl::format( "%sVar:%d value:%s ts:%s",
|
||||
pad.c_str(), i, s ? s : "?", fTimeStamp.AtEpoch() ? "0" : fTimeStamp.Format("%c").c_str() );
|
||||
logMsg += plString::Format( "%sVar:%d value:%s ts:%s",
|
||||
pad.c_str(), i, s.c_str("?"), fTimeStamp.AtEpoch() ? "0" : fTimeStamp.Format("%c").c_str() );
|
||||
}
|
||||
delete [] s;
|
||||
|
||||
if ( !dirtyOnly )
|
||||
logMsg += xtl::format( " dirty:%d", IsDirty() );
|
||||
logMsg += plString::Format( " dirty:%d", IsDirty() );
|
||||
|
||||
dbg->LogMsg(logMsg.c_str());
|
||||
logMsg = "";
|
||||
@ -2329,12 +2318,12 @@ void plSimpleStateVariable::DumpToObjectDebugger(bool dirtyOnly, int level) cons
|
||||
|
||||
void plSimpleStateVariable::DumpToStream(hsStream* stream, bool dirtyOnly, int level) const
|
||||
{
|
||||
std::string pad;
|
||||
plString pad;
|
||||
int i;
|
||||
for(i=0;i<level; i++)
|
||||
pad += " ";
|
||||
|
||||
std::string logMsg = xtl::format( "%sSimpleVar, name:%s[%d]", pad.c_str(), GetName(), GetCount());
|
||||
plString logMsg = plString::Format( "%sSimpleVar, name:%s[%d]", pad.c_str(), GetName().c_str(), GetCount());
|
||||
if (GetCount()>1)
|
||||
{
|
||||
stream->WriteString(logMsg.c_str()); // it's going to be a long msg, so print it on its own line
|
||||
@ -2344,22 +2333,21 @@ void plSimpleStateVariable::DumpToStream(hsStream* stream, bool dirtyOnly, int l
|
||||
pad += "\t";
|
||||
for(i=0;i<GetCount(); i++)
|
||||
{
|
||||
char* s=GetAsString(i);
|
||||
plString s=GetAsString(i);
|
||||
if (fVar.GetAtomicType() == plVarDescriptor::kTime)
|
||||
{
|
||||
const char* p=fT[i].PrintWMillis();
|
||||
logMsg += xtl::format( "%sVar:%d gameTime:%s pst:%s ts:%s",
|
||||
pad.c_str(), i, s ? s : "?", p, fTimeStamp.Format("%c").c_str() );
|
||||
logMsg += plString::Format( "%sVar:%d gameTime:%s pst:%s ts:%s",
|
||||
pad.c_str(), i, s.c_str("?"), p, fTimeStamp.Format("%c").c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
logMsg +=xtl::format( "%sVar:%d value:%s ts:%s",
|
||||
pad.c_str(), i, s ? s : "?", fTimeStamp.AtEpoch() ? "0" : fTimeStamp.Format("%c").c_str() );
|
||||
logMsg += plString::Format( "%sVar:%d value:%s ts:%s",
|
||||
pad.c_str(), i, s.c_str("?"), fTimeStamp.AtEpoch() ? "0" : fTimeStamp.Format("%c").c_str() );
|
||||
}
|
||||
delete [] s;
|
||||
|
||||
if ( !dirtyOnly )
|
||||
logMsg += xtl::format( " dirty:%d", IsDirty() );
|
||||
logMsg += plString::Format( " dirty:%d", IsDirty() );
|
||||
|
||||
stream->WriteString(logMsg.c_str());
|
||||
logMsg = "";
|
||||
@ -2497,9 +2485,9 @@ void plSDStateVariable::CopyFrom(plSDStateVariable* other, uint32_t writeOptions
|
||||
//
|
||||
void plSDStateVariable::UpdateFrom(plSDStateVariable* other, uint32_t writeOptions/*=0*/)
|
||||
{
|
||||
hsAssert(!stricmp(other->GetSDVarDescriptor()->GetName(), fVarDescriptor->GetName()),
|
||||
xtl::format("var descriptor mismatch in UpdateFrom, name %s,%s ver %d,%d",
|
||||
GetName(), other->GetName()).c_str());
|
||||
hsAssert(!other->GetSDVarDescriptor()->GetName().CompareI(fVarDescriptor->GetName()),
|
||||
plString::Format("var descriptor mismatch in UpdateFrom, name %s,%s ver %d,%d",
|
||||
GetName().c_str(), other->GetName().c_str()).c_str());
|
||||
Resize(other->GetCount()); // make sure sizes match
|
||||
|
||||
bool dirtyOnly = (writeOptions & plSDL::kDirtyOnly);
|
||||
@ -2521,8 +2509,8 @@ void plSDStateVariable::ConvertTo(plSDStateVariable* otherSDVar, bool force )
|
||||
plStateDescriptor* otherSD=otherSDVar->GetSDVarDescriptor()->GetStateDescriptor();
|
||||
|
||||
hsLogEntry( plNetApp::StaticDebugMsg( "SDSV(%p) converting %s from %s to %s (force:%d)",
|
||||
this, fVarDescriptor->GetName(), fVarDescriptor->GetTypeString(),
|
||||
otherSDVar->GetSDVarDescriptor()->GetTypeString(), force ) );
|
||||
this, fVarDescriptor->GetName().c_str(), fVarDescriptor->GetTypeString().c_str(),
|
||||
otherSDVar->GetSDVarDescriptor()->GetTypeString().c_str(), force ) );
|
||||
|
||||
int j;
|
||||
for(j=0;j<GetCount(); j++)
|
||||
|
@ -55,96 +55,77 @@ const uint8_t plVarDescriptor::kVersion=3; // for Read/Write format
|
||||
// State Var
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
plVarDescriptor::plVarDescriptor() :
|
||||
fName(nil),
|
||||
fCount(1),
|
||||
fType(kNone),
|
||||
fTypeString(nil),
|
||||
fDefault(nil),
|
||||
fFlags(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
plVarDescriptor::~plVarDescriptor()
|
||||
{
|
||||
delete [] fName;
|
||||
delete [] fDefault;
|
||||
delete [] fTypeString;
|
||||
}
|
||||
|
||||
//
|
||||
// Set type from a string. Return false on err.
|
||||
//
|
||||
bool plVarDescriptor::SetType(const char* type)
|
||||
bool plVarDescriptor::SetType(const plString& type)
|
||||
{
|
||||
if (!type)
|
||||
if (type.IsNull())
|
||||
return false;
|
||||
|
||||
if (!stricmp(type, "vector3"))
|
||||
if (!type.CompareI("vector3"))
|
||||
fType=kVector3;
|
||||
else
|
||||
if (!stricmp(type, "point3"))
|
||||
if (!type.CompareI("point3"))
|
||||
fType=kPoint3;
|
||||
else
|
||||
if (!stricmp(type, "rgb"))
|
||||
if (!type.CompareI("rgb"))
|
||||
fType=kRGB;
|
||||
else
|
||||
if (!stricmp(type, "rgba"))
|
||||
if (!type.CompareI("rgba"))
|
||||
fType=kRGBA;
|
||||
else
|
||||
if (!stricmp(type, "rgb8"))
|
||||
if (!type.CompareI("rgb8"))
|
||||
fType=kRGB8;
|
||||
else
|
||||
if (!stricmp(type, "rgba8"))
|
||||
if (!type.CompareI("rgba8"))
|
||||
fType=kRGBA8;
|
||||
else
|
||||
if (!strnicmp(type, "quat",4))
|
||||
if (!type.CompareNI("quat", 4))
|
||||
fType=kQuaternion;
|
||||
else
|
||||
if (!stricmp(type, "rgba"))
|
||||
if (!type.CompareI("rgba"))
|
||||
fType=kRGBA;
|
||||
else
|
||||
if (!stricmp(type, "int"))
|
||||
if (!type.CompareI("int"))
|
||||
fType=kInt;
|
||||
else
|
||||
if (!stricmp(type, "byte"))
|
||||
if (!type.CompareI("byte"))
|
||||
fType=kByte;
|
||||
else
|
||||
if (!stricmp(type, "short"))
|
||||
if (!type.CompareI("short"))
|
||||
fType=kShort;
|
||||
else
|
||||
if (!stricmp(type, "float"))
|
||||
if (!type.CompareI("float"))
|
||||
fType=kFloat;
|
||||
else
|
||||
if (!stricmp(type, "double"))
|
||||
if (!type.CompareI("double"))
|
||||
fType=kDouble;
|
||||
else
|
||||
if (!stricmp(type, "time"))
|
||||
if (!type.CompareI("time"))
|
||||
fType=kTime;
|
||||
else
|
||||
if (!stricmp(type, "ageTimeOfDay"))
|
||||
if (!type.CompareI("ageTimeOfDay"))
|
||||
fType=kAgeTimeOfDay;
|
||||
else
|
||||
if (!stricmp(type, "bool"))
|
||||
if (!type.CompareI("bool"))
|
||||
fType=kBool;
|
||||
else
|
||||
if (!stricmp(type, "string32"))
|
||||
if (!type.CompareI("string32"))
|
||||
fType=kString32;
|
||||
else
|
||||
if (!stricmp(type, "plKey"))
|
||||
if (!type.CompareI("plKey"))
|
||||
fType=kKey;
|
||||
else
|
||||
if (!stricmp(type, "message") || !stricmp(type, "creatable") )
|
||||
if (!type.CompareI("message") || !type.CompareI("creatable") )
|
||||
fType=kCreatable;
|
||||
else
|
||||
if (*type=='$')
|
||||
if (type.CharAt(0)=='$')
|
||||
fType=kStateDescriptor;
|
||||
else
|
||||
return false; // err
|
||||
|
||||
delete [] fTypeString;
|
||||
fTypeString = hsStrcpy(type);
|
||||
fTypeString = type;
|
||||
|
||||
return true; // ok
|
||||
}
|
||||
@ -156,8 +137,7 @@ void plVarDescriptor::CopyFrom(const plVarDescriptor* other)
|
||||
SetCount(other->GetCount());
|
||||
SetDisplayOptions(other->GetDisplayOptions());
|
||||
|
||||
delete [] fTypeString;
|
||||
fTypeString=hsStrcpy(other->GetTypeString());
|
||||
fTypeString=other->GetTypeString();
|
||||
|
||||
fType = other->GetType();
|
||||
fFlags = other->fFlags;
|
||||
@ -178,8 +158,7 @@ bool plVarDescriptor::Read(hsStream* s)
|
||||
return false;
|
||||
}
|
||||
|
||||
delete [] fName;
|
||||
fName=s->ReadSafeString();
|
||||
fName=s->ReadSafeString_TEMP();
|
||||
|
||||
plMsgStdStringHelper::Peek(fDisplayOptions, s);
|
||||
|
||||
@ -187,8 +166,7 @@ bool plVarDescriptor::Read(hsStream* s)
|
||||
|
||||
fType=(Type)s->ReadByte();
|
||||
|
||||
delete [] fDefault;
|
||||
fDefault = s->ReadSafeString();
|
||||
fDefault = s->ReadSafeString_TEMP();
|
||||
|
||||
fFlags = s->ReadLE32();
|
||||
return true;
|
||||
@ -259,87 +237,84 @@ int plSimpleVarDescriptor::GetSize() const
|
||||
// Set type from a string. Return false on err.
|
||||
// Sets atomicCount and atomicType
|
||||
//
|
||||
bool plSimpleVarDescriptor::SetType(const char* type)
|
||||
bool plSimpleVarDescriptor::SetType(const plString& type)
|
||||
{
|
||||
if (!type)
|
||||
return false;
|
||||
|
||||
if (!plVarDescriptor::SetType(type))
|
||||
return false;
|
||||
|
||||
if (!stricmp(type, "vector3"))
|
||||
if (!type.CompareI("vector3"))
|
||||
{
|
||||
fAtomicCount = 3;
|
||||
fAtomicType=kFloat;
|
||||
}
|
||||
else
|
||||
if (!stricmp(type, "point3"))
|
||||
if (!type.CompareI("point3"))
|
||||
{
|
||||
fAtomicCount = 3;
|
||||
fAtomicType=kFloat;
|
||||
}
|
||||
else
|
||||
if (!stricmp(type, "rgb"))
|
||||
if (!type.CompareI("rgb"))
|
||||
{
|
||||
fAtomicCount = 3;
|
||||
fAtomicType=kFloat;
|
||||
}
|
||||
else
|
||||
if (!stricmp(type, "rgba"))
|
||||
if (!type.CompareI("rgba"))
|
||||
{
|
||||
fAtomicCount = 4;
|
||||
fAtomicType=kFloat;
|
||||
}
|
||||
else
|
||||
if (!stricmp(type, "rgb8"))
|
||||
if (!type.CompareI("rgb8"))
|
||||
{
|
||||
fAtomicCount = 3;
|
||||
fAtomicType=kByte;
|
||||
}
|
||||
else
|
||||
if (!stricmp(type, "rgba8"))
|
||||
if (!type.CompareI("rgba8"))
|
||||
{
|
||||
fAtomicCount = 4;
|
||||
fAtomicType=kByte;
|
||||
}
|
||||
else
|
||||
if (!strnicmp(type, "quat",4))
|
||||
if (!type.CompareNI("quat", 4))
|
||||
{
|
||||
fAtomicCount = 4;
|
||||
fAtomicType=kFloat;
|
||||
}
|
||||
else
|
||||
if (!stricmp(type, "int"))
|
||||
if (!type.CompareI("int"))
|
||||
fAtomicType=kInt;
|
||||
else
|
||||
if (!stricmp(type, "byte"))
|
||||
if (!type.CompareI("byte"))
|
||||
fAtomicType=kByte;
|
||||
else
|
||||
if (!stricmp(type, "short"))
|
||||
if (!type.CompareI("short"))
|
||||
fAtomicType=kShort;
|
||||
else
|
||||
if (!stricmp(type, "float"))
|
||||
if (!type.CompareI("float"))
|
||||
fAtomicType=kFloat;
|
||||
else
|
||||
if (!stricmp(type, "double"))
|
||||
if (!type.CompareI("double"))
|
||||
fAtomicType=kDouble;
|
||||
else
|
||||
if (!stricmp(type, "time"))
|
||||
if (!type.CompareI("time"))
|
||||
fAtomicType=kTime;
|
||||
else
|
||||
if (!stricmp(type, "ageTimeOfDay"))
|
||||
if (!type.CompareI("ageTimeOfDay"))
|
||||
fAtomicType=kAgeTimeOfDay;
|
||||
else
|
||||
if (!stricmp(type, "bool"))
|
||||
if (!type.CompareI("bool"))
|
||||
fAtomicType=kBool;
|
||||
else
|
||||
if (!stricmp(type, "string32"))
|
||||
if (!type.CompareI("string32"))
|
||||
fAtomicType=kString32;
|
||||
else
|
||||
if (!stricmp(type, "plKey"))
|
||||
if (!type.CompareI("plKey"))
|
||||
fAtomicType=kKey;
|
||||
else
|
||||
if (!stricmp(type, "message") || !stricmp(type, "creatable"))
|
||||
if (!type.CompareI("message") || !type.CompareI("creatable"))
|
||||
fAtomicType=kCreatable;
|
||||
else
|
||||
return false; // err
|
||||
@ -398,12 +373,11 @@ bool plSDVarDescriptor::Read(hsStream* s)
|
||||
if (!plVarDescriptor::Read(s))
|
||||
return false;
|
||||
|
||||
char* sdName=s->ReadSafeString();
|
||||
plString sdName=s->ReadSafeString_TEMP();
|
||||
uint16_t version = s->ReadLE16();
|
||||
plStateDescriptor* sd=plSDLMgr::GetInstance()->FindDescriptor(sdName, version);
|
||||
hsAssert( sd, xtl::format("Failed to find sdl descriptor: %s,%d. Missing legacy descriptor?", sdName, version ).c_str() );
|
||||
hsAssert( sd, plString::Format("Failed to find sdl descriptor: %s,%d. Missing legacy descriptor?", sdName.c_str(), version ).c_str() );
|
||||
SetStateDesc(sd);
|
||||
delete [] sdName;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2424,13 +2424,9 @@ bool VaultAddOwnedAgeSpawnPoint (const Uuid & ageInstId, const plSpawnPointInfo
|
||||
RelVaultNode * link = nil;
|
||||
|
||||
for (;;) {
|
||||
if (!spawnPt.GetName())
|
||||
if (spawnPt.GetName().IsEmpty())
|
||||
break;
|
||||
if (!spawnPt.GetTitle())
|
||||
break;
|
||||
if (!StrLen(spawnPt.GetName()))
|
||||
break;
|
||||
if (!StrLen(spawnPt.GetTitle()))
|
||||
if (spawnPt.GetTitle().IsEmpty())
|
||||
break;
|
||||
|
||||
fldr = VaultGetAgesIOwnFolderIncRef();
|
||||
|
@ -534,13 +534,12 @@ bool VaultSDLNode::GetStateDataRecord (plStateDataRecord * rec, unsigned readOpt
|
||||
ram.Write(sdlDataLen, sdlData);
|
||||
ram.Rewind();
|
||||
|
||||
char * sdlRecName = nil;
|
||||
int sdlRecVersion;
|
||||
plString sdlRecName;
|
||||
int sdlRecVersion;
|
||||
if (!plStateDataRecord::ReadStreamHeader(&ram, &sdlRecName, &sdlRecVersion))
|
||||
return false;
|
||||
|
||||
rec->SetDescriptor(sdlRecName, sdlRecVersion);
|
||||
free(sdlRecName);
|
||||
|
||||
// Note: Setting from default here results in a bug causing age SDL to
|
||||
// be incorrectly shown when immediately linking back to an age you linked
|
||||
@ -698,14 +697,14 @@ bool VaultImageNode::ExtractImage (plMipmap ** dst) {
|
||||
#ifdef CLIENT
|
||||
struct MatchesSpawnPointTitle
|
||||
{
|
||||
std::string fTitle;
|
||||
MatchesSpawnPointTitle( const char * title ):fTitle( title ){}
|
||||
plString fTitle;
|
||||
MatchesSpawnPointTitle( const plString & title ):fTitle( title ){}
|
||||
bool operator ()( const plSpawnPointInfo & p ) const { return ( p.fTitle==fTitle ); }
|
||||
};
|
||||
struct MatchesSpawnPointName
|
||||
{
|
||||
std::string fName;
|
||||
MatchesSpawnPointName( const char * name ):fName( name ){}
|
||||
plString fName;
|
||||
MatchesSpawnPointName( const plString & name ):fName( name ){}
|
||||
bool operator ()( const plSpawnPointInfo & p ) const { return ( p.fSpawnPt==fName ); }
|
||||
};
|
||||
#endif
|
||||
@ -768,7 +767,7 @@ void VaultAgeLinkNode::AddSpawnPoint (const plSpawnPointInfo & point) {
|
||||
|
||||
//============================================================================
|
||||
#ifdef CLIENT
|
||||
void VaultAgeLinkNode::RemoveSpawnPoint (const char spawnPtName[]) {
|
||||
void VaultAgeLinkNode::RemoveSpawnPoint (const plString & spawnPtName) {
|
||||
|
||||
plSpawnPointVec points;
|
||||
GetSpawnPoints( &points );
|
||||
@ -784,7 +783,7 @@ void VaultAgeLinkNode::RemoveSpawnPoint (const char spawnPtName[]) {
|
||||
|
||||
//============================================================================
|
||||
#ifdef CLIENT
|
||||
bool VaultAgeLinkNode::HasSpawnPoint (const char spawnPtName[]) const {
|
||||
bool VaultAgeLinkNode::HasSpawnPoint (const plString & spawnPtName) const {
|
||||
|
||||
plSpawnPointVec points;
|
||||
GetSpawnPoints( &points );
|
||||
@ -804,23 +803,18 @@ bool VaultAgeLinkNode::HasSpawnPoint (const plSpawnPointInfo & point) const {
|
||||
#ifdef CLIENT
|
||||
void VaultAgeLinkNode::GetSpawnPoints (plSpawnPointVec * out) const {
|
||||
|
||||
char str[2048];
|
||||
memset(&str, 0, sizeof(str));
|
||||
memcpy(str, spawnPoints, min(spawnPointsLen, arrsize(str) - 1));
|
||||
|
||||
char token1[ 1024 ];
|
||||
hsStringTokenizer izer1( str, ";" );
|
||||
while ( izer1.Next( token1, sizeof( token1 ) ) )
|
||||
plString str = plString::FromUtf8(reinterpret_cast<const char*>(spawnPoints), spawnPointsLen);
|
||||
std::vector<plString> izer = str.Tokenize(";");
|
||||
for (auto token1 = izer.begin(); token1 != izer.end(); ++token1)
|
||||
{
|
||||
plSpawnPointInfo point;
|
||||
char token2[ 1024 ];
|
||||
hsStringTokenizer izer2( token1, ":" );
|
||||
if ( izer2.Next( token2, sizeof( token2 ) ) )
|
||||
point.fTitle = token2;
|
||||
if ( izer2.Next( token2, sizeof( token2 ) ) )
|
||||
point.fSpawnPt = token2;
|
||||
if ( izer2.Next( token2, sizeof( token2 ) ) )
|
||||
point.fCameraStack = token2;
|
||||
std::vector<plString> izer2 = token1->Tokenize(":");
|
||||
if ( izer2.size() > 0)
|
||||
point.fTitle = izer2[0];
|
||||
if ( izer2.size() > 1)
|
||||
point.fSpawnPt = izer2[1];
|
||||
if ( izer2.size() > 2)
|
||||
point.fSpawnPt = izer2[2];
|
||||
|
||||
out->push_back(point);
|
||||
}
|
||||
@ -831,7 +825,7 @@ void VaultAgeLinkNode::GetSpawnPoints (plSpawnPointVec * out) const {
|
||||
#ifdef CLIENT
|
||||
void VaultAgeLinkNode::SetSpawnPoints (const plSpawnPointVec & in) {
|
||||
|
||||
std::stringstream ss;
|
||||
plStringStream ss;
|
||||
for ( unsigned i=0; i<in.size(); i++ ) {
|
||||
ss
|
||||
<< in[i].fTitle << ":"
|
||||
@ -843,8 +837,8 @@ void VaultAgeLinkNode::SetSpawnPoints (const plSpawnPointVec & in) {
|
||||
base,
|
||||
&spawnPoints,
|
||||
&spawnPointsLen,
|
||||
(const uint8_t *)ss.str().c_str(),
|
||||
ss.str().size()
|
||||
(const uint8_t *)ss.GetString().c_str(),
|
||||
ss.GetLength()
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
@ -277,8 +277,8 @@ struct VaultAgeLinkNode : NetVaultNodeAccess {
|
||||
#ifdef CLIENT
|
||||
bool CopyTo (plAgeLinkStruct * link);
|
||||
void AddSpawnPoint (const plSpawnPointInfo & point); // will only add if not there already.
|
||||
void RemoveSpawnPoint (const char spawnPtName[]);
|
||||
bool HasSpawnPoint (const char spawnPtName[]) const;
|
||||
void RemoveSpawnPoint (const plString & spawnPtName);
|
||||
bool HasSpawnPoint (const plString & spawnPtName) const;
|
||||
bool HasSpawnPoint (const plSpawnPointInfo & point) const; // compares spawn name only, not title.
|
||||
void GetSpawnPoints (plSpawnPointVec * out) const;
|
||||
void SetSpawnPoints (const plSpawnPointVec & in);
|
||||
|
Reference in New Issue
Block a user