|
|
|
@ -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; |
|
|
|
|