mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Python file names and SynchedObj SDL state names => plString
This commit is contained in:
@ -190,7 +190,7 @@ void plSynchedObject::RegisterSynchedValueFriend(plSynchedValueBase* v)
|
||||
//
|
||||
// send sdl state msg immediately
|
||||
//
|
||||
void plSynchedObject::SendSDLStateMsg(const char* SDLStateName, uint32_t synchFlags /*SendSDLStateFlags*/)
|
||||
void plSynchedObject::SendSDLStateMsg(const plString& SDLStateName, uint32_t synchFlags /*SendSDLStateFlags*/)
|
||||
{
|
||||
plSDLModifierMsg* sdlMsg = new plSDLModifierMsg(SDLStateName,
|
||||
(synchFlags & kBCastToClients) ? plSDLModifierMsg::kSendToServerAndClients : plSDLModifierMsg::kSendToServer /* action */);
|
||||
@ -203,14 +203,14 @@ void plSynchedObject::SendSDLStateMsg(const char* SDLStateName, uint32_t synchFl
|
||||
// Tell an object to send an sdl state update.
|
||||
// The request will get queued (returns true)
|
||||
//
|
||||
bool plSynchedObject::DirtySynchState(const char* SDLStateName, uint32_t synchFlags /*SendSDLStateFlags*/)
|
||||
bool plSynchedObject::DirtySynchState(const plString& SDLStateName, uint32_t synchFlags /*SendSDLStateFlags*/)
|
||||
{
|
||||
if (!IOKToDirty(SDLStateName))
|
||||
{
|
||||
#if 0
|
||||
if (plNetClientApp::GetInstance())
|
||||
plNetClientApp::GetInstance()->DebugMsg("NotOKToDirty - Not queueing SDL state, obj %s, sdl %s",
|
||||
GetKeyName(), SDLStateName);
|
||||
GetKeyName().c_str(), SDLStateName.c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -220,7 +220,7 @@ bool plSynchedObject::DirtySynchState(const char* SDLStateName, uint32_t synchFl
|
||||
#if 0
|
||||
if (plNetClientApp::GetInstance())
|
||||
plNetClientApp::GetInstance()->DebugMsg("LocalOnly Object - Not queueing SDL msg, obj %s, sdl %s",
|
||||
GetKeyName(), SDLStateName);
|
||||
GetKeyName().c_str(), SDLStateName.c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -236,7 +236,7 @@ bool plSynchedObject::DirtySynchState(const char* SDLStateName, uint32_t synchFl
|
||||
{
|
||||
if (plNetClientApp::GetInstance())
|
||||
plNetClientApp::GetInstance()->DebugMsg("Queueing SDL state with 'maybe' ownership, obj %s, sdl %s",
|
||||
GetKeyName().c_str(), SDLStateName);
|
||||
GetKeyName().c_str(), SDLStateName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,13 +256,13 @@ bool plSynchedObject::DirtySynchState(const char* SDLStateName, uint32_t synchFl
|
||||
// add state defn if not already there.
|
||||
// if there adjust flags if necessary
|
||||
//
|
||||
void plSynchedObject::IAddDirtyState(plKey objKey, const char* sdlName, uint32_t sendFlags)
|
||||
void plSynchedObject::IAddDirtyState(plKey objKey, const plString& sdlName, uint32_t sendFlags)
|
||||
{
|
||||
bool found=false;
|
||||
std::vector<StateDefn>::iterator it=fDirtyStates.begin();
|
||||
for( ; it != fDirtyStates.end(); it++)
|
||||
{
|
||||
if ((*it).fObjKey==objKey && !stricmp((*it).fSDLName.c_str(), sdlName))
|
||||
if (it->fObjKey == objKey && it->fSDLName.CompareI(sdlName) == 0)
|
||||
{
|
||||
if (sendFlags & kForceFullSend)
|
||||
(*it).fSendFlags |= kForceFullSend;
|
||||
@ -282,7 +282,7 @@ void plSynchedObject::IAddDirtyState(plKey objKey, const char* sdlName, uint32_t
|
||||
{
|
||||
#if 0
|
||||
plNetClientApp::GetInstance()->DebugMsg("Not queueing diplicate request for SDL state, obj %s, sdl %s",
|
||||
objKey->GetName(), sdlName);
|
||||
objKey->GetName().c_str(), sdlName.c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -290,12 +290,12 @@ void plSynchedObject::IAddDirtyState(plKey objKey, const char* sdlName, uint32_t
|
||||
//
|
||||
// STATIC
|
||||
//
|
||||
void plSynchedObject::IRemoveDirtyState(plKey objKey, const char* sdlName)
|
||||
void plSynchedObject::IRemoveDirtyState(plKey objKey, const plString& sdlName)
|
||||
{
|
||||
std::vector<StateDefn>::iterator it=fDirtyStates.begin();
|
||||
for( ; it != fDirtyStates.end(); it++)
|
||||
{
|
||||
if ((*it).fObjKey==objKey && !stricmp((*it).fSDLName.c_str(), sdlName))
|
||||
if (it->fObjKey == objKey && it->fSDLName.CompareI(sdlName) == 0)
|
||||
{
|
||||
fDirtyStates.erase(it);
|
||||
break;
|
||||
@ -342,7 +342,7 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
int i;
|
||||
for(i=0;i<num;i++)
|
||||
{
|
||||
std::string s;
|
||||
plString s;
|
||||
plMsgStdStringHelper::Peek(s, stream);
|
||||
fSDLExcludeList.push_back(s);
|
||||
}
|
||||
@ -356,7 +356,7 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
int i;
|
||||
for(i=0;i<num;i++)
|
||||
{
|
||||
std::string s;
|
||||
plString s;
|
||||
plMsgStdStringHelper::Peek(s, stream);
|
||||
fSDLVolatileList.push_back(s);
|
||||
}
|
||||
@ -449,7 +449,7 @@ void plSynchedObject::CallDirtyNotifiers() {}
|
||||
//
|
||||
// return true if it's ok to dirty this object
|
||||
//
|
||||
bool plSynchedObject::IOKToDirty(const char* SDLStateName) const
|
||||
bool plSynchedObject::IOKToDirty(const plString& SDLStateName) const
|
||||
{
|
||||
// is synching disabled?
|
||||
bool synchDisabled = (GetSynchDisabled()!=0);
|
||||
@ -471,7 +471,7 @@ bool plSynchedObject::IOKToDirty(const char* SDLStateName) const
|
||||
//
|
||||
// return true if this object should send his SDL msg (for persistence or synch) over the net
|
||||
//
|
||||
bool plSynchedObject::IOKToNetwork(const char* sdlName, uint32_t* synchFlags) const
|
||||
bool plSynchedObject::IOKToNetwork(const plString& sdlName, uint32_t* synchFlags) const
|
||||
{
|
||||
// determine destination
|
||||
bool dstServerOnly=false, dstClientsOnly=false, dstClientsAndServer=false;
|
||||
@ -523,14 +523,14 @@ bool plSynchedObject::IOKToNetwork(const char* sdlName, uint32_t* synchFlags) co
|
||||
return false;
|
||||
}
|
||||
|
||||
plSynchedObject::SDLStateList::const_iterator plSynchedObject::IFindInSDLStateList(const SDLStateList& list, const char* sdlName) const
|
||||
plSynchedObject::SDLStateList::const_iterator plSynchedObject::IFindInSDLStateList(const SDLStateList& list, const plString& sdlName) const
|
||||
{
|
||||
if (!sdlName)
|
||||
if (sdlName.IsEmpty())
|
||||
return list.end(); // false
|
||||
|
||||
SDLStateList::const_iterator it = list.begin();
|
||||
for(; it != list.end(); it++)
|
||||
if (!stricmp((*it).c_str(), sdlName))
|
||||
if (it->CompareI(sdlName) == 0)
|
||||
return it;
|
||||
|
||||
return it; // .end(), false
|
||||
@ -540,19 +540,19 @@ plSynchedObject::SDLStateList::const_iterator plSynchedObject::IFindInSDLStateLi
|
||||
// EXCLUDE LIST
|
||||
///////////////////////////
|
||||
|
||||
void plSynchedObject::AddToSDLExcludeList(const char* sdlName)
|
||||
void plSynchedObject::AddToSDLExcludeList(const plString& sdlName)
|
||||
{
|
||||
if (sdlName)
|
||||
if (!sdlName.IsEmpty())
|
||||
{
|
||||
if (IFindInSDLStateList(fSDLExcludeList, sdlName)==fSDLExcludeList.end())
|
||||
{
|
||||
fSDLExcludeList.push_back(sdlName); // Don't dupe sdlName, std::string will copy
|
||||
fSDLExcludeList.push_back(sdlName);
|
||||
fSynchFlags |= kExcludePersistentState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void plSynchedObject::RemoveFromSDLExcludeList(const char* sdlName)
|
||||
void plSynchedObject::RemoveFromSDLExcludeList(const plString& sdlName)
|
||||
{
|
||||
SDLStateList::const_iterator it=IFindInSDLStateList(fSDLExcludeList, sdlName);
|
||||
if (it != fSDLExcludeList.end())
|
||||
@ -563,7 +563,7 @@ void plSynchedObject::RemoveFromSDLExcludeList(const char* sdlName)
|
||||
}
|
||||
}
|
||||
|
||||
bool plSynchedObject::IsInSDLExcludeList(const char* sdlName) const
|
||||
bool plSynchedObject::IsInSDLExcludeList(const plString& sdlName) const
|
||||
{
|
||||
if ((fSynchFlags & kExcludeAllPersistentState) != 0)
|
||||
return true;
|
||||
@ -579,9 +579,9 @@ bool plSynchedObject::IsInSDLExcludeList(const char* sdlName) const
|
||||
// VOLATILE LIST
|
||||
///////////////////////////
|
||||
|
||||
void plSynchedObject::AddToSDLVolatileList(const char* sdlName)
|
||||
void plSynchedObject::AddToSDLVolatileList(const plString& sdlName)
|
||||
{
|
||||
if (sdlName)
|
||||
if (!sdlName.IsEmpty())
|
||||
{
|
||||
if (IFindInSDLStateList(fSDLVolatileList,sdlName)==fSDLVolatileList.end())
|
||||
{
|
||||
@ -591,7 +591,7 @@ void plSynchedObject::AddToSDLVolatileList(const char* sdlName)
|
||||
}
|
||||
}
|
||||
|
||||
void plSynchedObject::RemoveFromSDLVolatileList(const char* sdlName)
|
||||
void plSynchedObject::RemoveFromSDLVolatileList(const plString& sdlName)
|
||||
{
|
||||
SDLStateList::const_iterator it=IFindInSDLStateList(fSDLVolatileList,sdlName);
|
||||
if (it != fSDLVolatileList.end())
|
||||
@ -602,7 +602,7 @@ void plSynchedObject::RemoveFromSDLVolatileList(const char* sdlName)
|
||||
}
|
||||
}
|
||||
|
||||
bool plSynchedObject::IsInSDLVolatileList(const char* sdlName) const
|
||||
bool plSynchedObject::IsInSDLVolatileList(const plString& sdlName) const
|
||||
{
|
||||
if ((fSynchFlags & kAllStateIsVolatile) != 0)
|
||||
return true;
|
||||
|
@ -89,17 +89,18 @@ public:
|
||||
|
||||
struct StateDefn
|
||||
{
|
||||
plKey fObjKey;
|
||||
plKey fObjKey;
|
||||
uint32_t fSendFlags;
|
||||
std::string fSDLName;
|
||||
plString fSDLName;
|
||||
|
||||
plSynchedObject* GetObject() const { return plSynchedObject::ConvertNoRef(fObjKey->ObjectIsLoaded()); }
|
||||
StateDefn() : fObjKey(nil),fSendFlags(0) {}
|
||||
StateDefn(plKey k, uint32_t f, const char* sdlName) : fObjKey(k),fSendFlags(f) { fSDLName=sdlName; }
|
||||
StateDefn(plKey k, uint32_t f, const plString& sdlName)
|
||||
: fObjKey(k), fSendFlags(f), fSDLName(sdlName) { }
|
||||
};
|
||||
|
||||
private:
|
||||
typedef std::vector<std::string> SDLStateList;
|
||||
typedef std::vector<plString> SDLStateList;
|
||||
SDLStateList fSDLExcludeList;
|
||||
SDLStateList fSDLVolatileList;
|
||||
uint32_t fSynchFlags;
|
||||
@ -110,12 +111,12 @@ private:
|
||||
static plSynchedObject* fStaticSynchedObj; // static which temporarily holds address of each object's synchMgr
|
||||
static std::vector<StateDefn> fDirtyStates;
|
||||
|
||||
static void IRemoveDirtyState(plKey o, const char* sdlName);
|
||||
static void IAddDirtyState(plKey o, const char* sdlName, uint32_t sendFlags);
|
||||
bool IOKToDirty(const char* SDLStateName) const;
|
||||
SDLStateList::const_iterator IFindInSDLStateList(const SDLStateList& list, const char* sdlName) const;
|
||||
static void IRemoveDirtyState(plKey o, const plString& sdlName);
|
||||
static void IAddDirtyState(plKey o, const plString& sdlName, uint32_t sendFlags);
|
||||
bool IOKToDirty(const plString& SDLStateName) const;
|
||||
SDLStateList::const_iterator IFindInSDLStateList(const SDLStateList& list, const plString& sdlName) const;
|
||||
protected:
|
||||
bool IOKToNetwork(const char* sdlName, uint32_t* synchFlags) const;
|
||||
bool IOKToNetwork(const plString& sdlName, uint32_t* synchFlags) const;
|
||||
public:
|
||||
plSynchedObject();
|
||||
virtual ~plSynchedObject();
|
||||
@ -136,8 +137,8 @@ public:
|
||||
virtual void SetNetGroup(plNetGroupId netGroup) { fNetGroup = netGroup; }
|
||||
plNetGroupId SelectNetGroup(plKey groupKey);
|
||||
|
||||
virtual bool DirtySynchState(const char* sdlName, uint32_t sendFlags);
|
||||
void SendSDLStateMsg(const char* SDLStateName, uint32_t synchFlags); // don't use, only for net code
|
||||
virtual bool DirtySynchState(const plString& sdlName, uint32_t sendFlags);
|
||||
void SendSDLStateMsg(const plString& SDLStateName, uint32_t synchFlags); // don't use, only for net code
|
||||
|
||||
void ClearSynchFlagsBit(uint32_t f) { fSynchFlags &= ~f; }
|
||||
|
||||
@ -168,14 +169,14 @@ public:
|
||||
void SetLocalOnly(bool b) { if (b) fSynchFlags |= kLocalOnly; else fSynchFlags &= ~kLocalOnly; }
|
||||
|
||||
// disable particular types of persistence
|
||||
void AddToSDLExcludeList(const char*);
|
||||
void RemoveFromSDLExcludeList(const char*);
|
||||
bool IsInSDLExcludeList(const char*) const;
|
||||
void AddToSDLExcludeList(const plString&);
|
||||
void RemoveFromSDLExcludeList(const plString&);
|
||||
bool IsInSDLExcludeList(const plString&) const;
|
||||
|
||||
// make volatile particular types of state
|
||||
void AddToSDLVolatileList(const char*);
|
||||
void RemoveFromSDLVolatileList(const char*);
|
||||
bool IsInSDLVolatileList(const char*) const;
|
||||
void AddToSDLVolatileList(const plString&);
|
||||
void RemoveFromSDLVolatileList(const plString&);
|
||||
bool IsInSDLVolatileList(const plString&) const;
|
||||
|
||||
//
|
||||
// synched value stuff, currently unused
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
{
|
||||
MakeDirty(); // dirty value
|
||||
if (GetSynchedObject())
|
||||
GetSynchedObject()->DirtySynchState(nil, 0); // dirty owner
|
||||
GetSynchedObject()->DirtySynchState(plString::Null, 0); // dirty owner
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user