Browse Source

Python file names and SynchedObj SDL state names => plString

Michael Hansen 11 years ago
parent
commit
a783642515
  1. 4
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  2. 4
      Sources/Plasma/FeatureLib/pfPython/cyMisc.h
  3. 36
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
  4. 4
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h
  5. 26
      Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp
  6. 5
      Sources/Plasma/FeatureLib/pfPython/plPythonPack.h
  7. 6
      Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp
  8. 2
      Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.h
  9. 2
      Sources/Plasma/FeatureLib/pfPython/pyKey.cpp
  10. 2
      Sources/Plasma/FeatureLib/pfPython/pyKey.h
  11. 52
      Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp
  12. 35
      Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.h
  13. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h
  14. 2
      Sources/Plasma/PubUtilLib/plAudio/plSound.cpp
  15. 2
      Sources/Plasma/PubUtilLib/plAudio/plSound.h
  16. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp
  17. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h
  18. 4
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp
  19. 2
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h
  20. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp
  21. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h
  22. 2
      Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp
  23. 2
      Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.h
  24. 2
      Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h
  25. 4
      Sources/Tools/MaxMain/plMaxNode.cpp

4
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -443,7 +443,7 @@ void cyMisc::DetachObjectSO(pySceneObject& cobj, pySceneObject& pobj, bool netFo
//
// PURPOSE : set the Python modifier to be dirty and asked to be saved out
//
void cyMisc::SetDirtySyncState(pyKey &selfkey, const char* SDLStateName, uint32_t sendFlags)
void cyMisc::SetDirtySyncState(pyKey &selfkey, const plString& SDLStateName, uint32_t sendFlags)
{
selfkey.DirtySynchState(SDLStateName, sendFlags);
}
@ -455,7 +455,7 @@ void cyMisc::SetDirtySyncState(pyKey &selfkey, const char* SDLStateName, uint32_
//
// PURPOSE : set the Python modifier to be dirty and asked to be saved out
//
void cyMisc::SetDirtySyncStateWithClients(pyKey &selfkey, const char* SDLStateName, uint32_t sendFlags)
void cyMisc::SetDirtySyncStateWithClients(pyKey &selfkey, const plString& SDLStateName, uint32_t sendFlags)
{
selfkey.DirtySynchState(SDLStateName, sendFlags|plSynchedObject::kBCastToClients);
}

4
Sources/Plasma/FeatureLib/pfPython/cyMisc.h

@ -217,7 +217,7 @@ public:
//
// PURPOSE : set the Python modifier to be dirty and asked to be saved out
//
static void SetDirtySyncState(pyKey &selfkey, const char* SDLStateName, uint32_t sendFlags);
static void SetDirtySyncState(pyKey &selfkey, const plString& SDLStateName, uint32_t sendFlags);
/////////////////////////////////////////////////////////////////////////////
//
@ -227,7 +227,7 @@ public:
// PURPOSE : set the Python modifier to be dirty and asked to be saved out
// specifies that state should be sent to other clients as well as server
//
static void SetDirtySyncStateWithClients(pyKey &selfkey, const char* SDLStateName, uint32_t sendFlags);
static void SetDirtySyncStateWithClients(pyKey &selfkey, const plString& SDLStateName, uint32_t sendFlags);
/////////////////////////////////////////////////////////////////////////////
//

36
Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp

@ -336,7 +336,6 @@ bool plPythonFileMod::fAtConvertTime = false;
//
plPythonFileMod::plPythonFileMod()
{
fPythonFile = nil;
fModule = nil;
fLocalNotify= true;
fIsFirstTimeEval = true;
@ -401,12 +400,6 @@ plPythonFileMod::~plPythonFileMod()
fSelfKey = nil;
}
// get rid of the python code
if ( fPythonFile )
{
delete [] fPythonFile;
fPythonFile = nil;
}
// then get rid of this module
// NOTE: fModule shouldn't be made in the plugin, only at runtime
if ( !fModuleName.IsNull() && fModule )
@ -438,14 +431,14 @@ bool plPythonFileMod::ILoadPythonCode()
#ifndef PLASMA_EXTERNAL_RELEASE
// get code from file and execute in module
// see if the file exists first before trying to import it
plFileName pyfile = plFileName::Join(".", "python", plString::Format("%s.py", fPythonFile));
plFileName pyfile = plFileName::Join(".", "python", plString::Format("%s.py", fPythonFile.c_str()));
if (plFileInfo(pyfile).Exists())
{
char fromLoad[256];
//sprintf(fromLoad,"from %s import *", fPythonFile);
//sprintf(fromLoad,"from %s import *", fPythonFile.c_str());
// ok... we can't really use import because Python remembers too much where global variables came from
// ...and using execfile make it sure that globals are defined in this module and not in the imported module
sprintf(fromLoad,"execfile('.\\\\python\\\\%s.py')", fPythonFile);
sprintf(fromLoad,"execfile('.\\\\python\\\\%s.py')", fPythonFile.c_str());
if ( PythonInterface::RunString( fromLoad, fModule) )
{
// we've loaded the code into our module
@ -461,7 +454,7 @@ bool plPythonFileMod::ILoadPythonCode()
}
DisplayPythonOutput();
char errMsg[256];
sprintf(errMsg,"Python file %s.py had errors!!! Could not load.",fPythonFile);
snprintf(errMsg, arrsize(errMsg), "Python file %s.py had errors!!! Could not load.", fPythonFile.c_str());
PythonInterface::WriteToLog(errMsg);
hsAssert(0,errMsg);
return false;
@ -476,7 +469,7 @@ bool plPythonFileMod::ILoadPythonCode()
DisplayPythonOutput();
char errMsg[256];
sprintf(errMsg,"Python file %s.py was not found.",fPythonFile);
snprintf(errMsg, arrsize(errMsg), "Python file %s.py was not found.", fPythonFile.c_str());
PythonInterface::WriteToLog(errMsg);
hsAssert(0,errMsg);
return false;
@ -503,7 +496,7 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
if ( !fAtConvertTime ) // if this is just an Add that's during a convert, then don't do anymore
{
// was there a python file module with this?
if ( fPythonFile )
if ( !fPythonFile.IsEmpty() )
{
// has the module not been initialized yet
if ( !fModule )
@ -523,7 +516,7 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
// set the name of the file (in the global dictionary of the module)
PyObject* dict = PyModule_GetDict(fModule);
PyObject* pfilename = PyString_FromString(fPythonFile);
PyObject* pfilename = PyString_FromPlString(fPythonFile);
PyDict_SetItemString(dict, "glue_name", pfilename);
// next we need to:
// - create instance of class
@ -542,7 +535,7 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
{
// display any output (NOTE: this would be disabled in production)
char errMsg[256];
sprintf(errMsg,"Python file %s.py, instance not found.",fPythonFile);
snprintf(errMsg, arrsize(errMsg), "Python file %s.py, instance not found.", fPythonFile.c_str());
PythonInterface::WriteToLog(errMsg);
hsAssert(0, errMsg);
return; // if we can't create the instance then there is nothing to do here
@ -2933,10 +2926,9 @@ void plPythonFileMod::DisplayPythonOutput()
// : Compile it into a Python code object
// : (This is usually called by the component)
//
void plPythonFileMod::SetSourceFile(const char* filename)
void plPythonFileMod::SetSourceFile(const plString& filename)
{
delete [] fPythonFile;
fPythonFile = hsStrcpy(filename);
fPythonFile = filename;
}
/////////////////////////////////////////////////////////////////////////////
@ -2996,13 +2988,7 @@ void plPythonFileMod::Read(hsStream* stream, hsResMgr* mgr)
plMultiModifier::Read(stream, mgr);
// read in the compile python code (pyc)
if ( fPythonFile )
{
// if we already have some code, get rid of it!
delete [] fPythonFile;
fPythonFile = nil;
}
fPythonFile = stream->ReadSafeString();
fPythonFile = stream->ReadSafeString_TEMP();
// then read in the list of receivers that want to be notified
int nRcvs = stream->ReadLE32();

4
Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h

@ -73,7 +73,7 @@ protected:
plString IMakeModuleName(plSceneObject* sobj);
char* fPythonFile;
plString fPythonFile;
plString fModuleName;
// the list of receivers that want to be notified
@ -131,7 +131,7 @@ public:
plPythonSDLModifier* GetSDLMod() { return fSDLMod; }
bool WasLocalNotify() { return fLocalNotify; }
plPipeline* GetPipeline() { return fPipe; }
virtual void SetSourceFile(const char* filename);
virtual void SetSourceFile(const plString& filename);
virtual int getPythonOutput(std::string* line);
virtual void ReportError();
virtual void DisplayPythonOutput();

26
Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp

@ -68,7 +68,7 @@ protected:
std::vector<hsStream*> fPackStreams;
bool fPackNotFound; // No pack file, don't keep trying
typedef std::map<std::string, plPackOffsetInfo> FileOffset;
typedef std::map<plString, plPackOffsetInfo> FileOffset;
FileOffset fFileOffsets;
plPythonPack();
@ -81,16 +81,16 @@ public:
bool Open();
void Close();
PyObject* OpenPacked(const char *fileName);
bool IsPackedFile(const char* fileName);
PyObject* OpenPacked(const plString& sfileName);
bool IsPackedFile(const plString& fileName);
};
PyObject* PythonPack::OpenPythonPacked(const char* fileName)
PyObject* PythonPack::OpenPythonPacked(const plString& fileName)
{
return plPythonPack::Instance().OpenPacked(fileName);
}
bool PythonPack::IsItPythonPacked(const char* fileName)
bool PythonPack::IsItPythonPacked(const plString& fileName)
{
return plPythonPack::Instance().IsPackedFile(fileName);
}
@ -148,9 +148,7 @@ bool plPythonPack::Open()
for (int i = 0; i < numFiles; i++)
{
// and pack the index into our own data structure
char* buf = fPackStream->ReadSafeString();
std::string pythonName = buf; // reading a "string" from a hsStream directly into a stl string causes memory loss
delete [] buf;
plString pythonName = fPackStream->ReadSafeString_TEMP();
uint32_t offset = fPackStream->ReadLE32();
plPackOffsetInfo offsetInfo;
@ -191,13 +189,12 @@ void plPythonPack::Close()
fFileOffsets.clear();
}
PyObject* plPythonPack::OpenPacked(const char* fileName)
PyObject* plPythonPack::OpenPacked(const plString& fileName)
{
if (!Open())
return nil;
std::string pythonName = fileName;
pythonName += ".py";
plString pythonName = fileName + ".py";
FileOffset::iterator it = fFileOffsets.find(pythonName);
if (it != fFileOffsets.end())
@ -213,7 +210,7 @@ PyObject* plPythonPack::OpenPacked(const char* fileName)
char *buf = new char[size];
uint32_t readSize = fPackStream->Read(size, buf);
hsAssert(readSize <= size, plString::Format("Python PackFile %s: Incorrect amount of data, read %d instead of %d",
fileName, readSize, size).c_str());
fileName.c_str(), readSize, size).c_str());
// let the python marshal make it back into a code object
PyObject *pythonCode = PyMarshal_ReadObjectFromString(buf, size);
@ -227,13 +224,12 @@ PyObject* plPythonPack::OpenPacked(const char* fileName)
return nil;
}
bool plPythonPack::IsPackedFile(const char* fileName)
bool plPythonPack::IsPackedFile(const plString& fileName)
{
if (!Open())
return nil;
std::string pythonName = fileName;
pythonName += ".py";
plString pythonName = fileName + ".py";
FileOffset:: iterator it = fFileOffsets.find(pythonName);
if (it != fFileOffsets.end())

5
Sources/Plasma/FeatureLib/pfPython/plPythonPack.h

@ -43,11 +43,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define plPythonPack_h_inc
typedef struct _object PyObject;
class plString;
namespace PythonPack
{
PyObject* OpenPythonPacked(const char* fileName);
bool IsItPythonPacked(const char* fileName);
PyObject* OpenPythonPacked(const plString& fileName);
bool IsItPythonPacked(const plString& fileName);
}
#endif // plPythonPack_h_inc

6
Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp

@ -265,7 +265,9 @@ void plPythonSDLModifier::SetItemIdx(const plString& key, int idx, PyObject* val
const char* plPythonSDLModifier::GetSDLName() const
{
return fOwner->fPythonFile;
// NOTE: Not changing GetSDLName since most implementations of this
// virtual function just return a stored string literal.
return fOwner->fPythonFile.c_str();
}
void plPythonSDLModifier::SetFlags(const plString& name, bool sendImmediate, bool skipOwnershipCheck)
@ -566,7 +568,7 @@ PyObject* plPythonSDLModifier::ISDLVarToPython(plSimpleStateVariable* var)
return pyTuple;
}
bool plPythonSDLModifier::HasSDL(const char* pythonFile)
bool plPythonSDLModifier::HasSDL(const plString& pythonFile)
{
return (plSDLMgr::GetInstance()->FindDescriptor(pythonFile, plSDL::kLatestVersion) != nil);
}

2
Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.h

@ -101,7 +101,7 @@ public:
virtual const char* GetSDLName() const;
virtual void SetItemFromSDLVar(plSimpleStateVariable* var);
static bool HasSDL(const char* pythonFile);
static bool HasSDL(const plString& pythonFile);
// find the Age global SDL guy... if there is one
static const plPythonSDLModifier* FindAgeSDL();
static plKey FindAgeSDLTarget();

2
Sources/Plasma/FeatureLib/pfPython/pyKey.cpp

@ -206,7 +206,7 @@ plKey pyKey::GetNotifyListItem(int32_t i)
// Set the dirty state on the PythonModifier
void pyKey::DirtySynchState(const char* SDLStateName, uint32_t sendFlags)
void pyKey::DirtySynchState(const plString& SDLStateName, uint32_t sendFlags)
{
// see if we have a PythonFileModifier pointer
if ( fPyFileMod )

2
Sources/Plasma/FeatureLib/pfPython/pyKey.h

@ -123,7 +123,7 @@ public:
// get a notify list item
virtual plKey GetNotifyListItem(int32_t i);
// Set the dirty state on the PythonModifier
virtual void DirtySynchState(const char* SDLStateName, uint32_t sendFlags);
virtual void DirtySynchState(const plString& SDLStateName, uint32_t sendFlags);
// register and unregister for control key envents
virtual void EnableControlKeyEvents();

52
Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp

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

35
Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.h

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

2
Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h

@ -144,7 +144,7 @@ public:
{
MakeDirty(); // dirty value
if (GetSynchedObject())
GetSynchedObject()->DirtySynchState(nil, 0); // dirty owner
GetSynchedObject()->DirtySynchState(plString::Null, 0); // dirty owner
}
}

2
Sources/Plasma/PubUtilLib/plAudio/plSound.cpp

@ -1480,7 +1480,7 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h
// call when state has changed
bool plSound::DirtySynchState(const char* sdlName /* kSDLSound */, uint32_t sendFlags)
bool plSound::DirtySynchState(const plString& sdlName /* kSDLSound */, uint32_t sendFlags)
{
/*
if( sdlName == nil )

2
Sources/Plasma/PubUtilLib/plAudio/plSound.h

@ -239,7 +239,7 @@ public:
virtual void UpdateSoftVolume( bool enable, bool firstTime = false );
virtual bool MsgReceive( plMessage* pMsg );
virtual bool DirtySynchState( const char *sdlName = nil, uint32_t sendFlags = 0 ); // call when state has changed
virtual bool DirtySynchState( const plString &sdlName = "", uint32_t sendFlags = 0 ); // call when state has changed
// Tests whether this sound is within range of the given position, not counting soft regions
bool IsWithinRange( const hsPoint3 &listenerPos, float *distSquared );

2
Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp

@ -799,7 +799,7 @@ bool plAGMasterMod::HasRunningAnims()
//
// Send SDL sendState msg to object's plAGMasterSDLModifier
//
bool plAGMasterMod::DirtySynchState(const char* SDLStateName, uint32_t synchFlags)
bool plAGMasterMod::DirtySynchState(const plString& SDLStateName, uint32_t synchFlags)
{
if(GetNumTargets() > 0 && (!fIsGrouped || fIsGroupMaster))
{

2
Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h

@ -206,7 +206,7 @@ public:
virtual void Read(hsStream * stream, hsResMgr *mgr);
bool HasRunningAnims();
bool DirtySynchState(const char* SDLStateName, uint32_t synchFlags);
bool DirtySynchState(const plString& SDLStateName, uint32_t synchFlags);
CLASSNAME_REGISTER( plAGMasterMod );
GETINTERFACE_ANY( plAGMasterMod, plModifier );

4
Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp

@ -1836,10 +1836,10 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr)
plgDispatch::Dispatch()->RegisterForExactType(plAvatarStealthModeMsg::Index(), GetKey());
}
bool plArmatureMod::DirtySynchState(const char* SDLStateName, uint32_t synchFlags)
bool plArmatureMod::DirtySynchState(const plString& SDLStateName, uint32_t synchFlags)
{
// skip requests to synch non-avatar state
if (SDLStateName && stricmp(SDLStateName, kSDLAvatar))
if (SDLStateName.CompareI(kSDLAvatar) != 0)
{
return false;
}

2
Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h

@ -283,7 +283,7 @@ public:
void SynchIfLocal(double timeNow, int force); // Just physical state
void SynchInputState(uint32_t rcvID = kInvalidPlayerID);
bool DirtySynchState(const char* SDLStateName, uint32_t synchFlags );
bool DirtySynchState(const plString& SDLStateName, uint32_t synchFlags );
bool DirtyPhysicalSynchState(uint32_t synchFlags);
plClothingOutfit *GetClothingOutfit() const { return fClothingOutfit; }
plClothingSDLModifier *GetClothingSDLMod() const { return fClothingSDLMod; }

2
Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp

@ -1405,7 +1405,7 @@ bool plClothingOutfit::MsgReceive(plMessage* msg)
// TESTING SDL
// Send clothing sendState msg to object's plClothingSDLModifier
//
bool plClothingOutfit::DirtySynchState(const char* SDLStateName, uint32_t synchFlags)
bool plClothingOutfit::DirtySynchState(const plString& SDLStateName, uint32_t synchFlags)
{
plSynchEnabler ps(true); // make sure synching is enabled, since this happens during load
synchFlags |= plSynchedObject::kForceFullSend; // TEMP

2
Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h

@ -195,7 +195,7 @@ public:
virtual void Read(hsStream* s, hsResMgr* mgr);
virtual void Write(hsStream* s, hsResMgr* mgr);
bool DirtySynchState(const char* SDLStateName, uint32_t synchFlags);
bool DirtySynchState(const plString& SDLStateName, uint32_t synchFlags);
void StripAccessories();
void WearDefaultClothing();

2
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp

@ -1010,7 +1010,7 @@ void plPXPhysical::Write(hsStream* stream, hsResMgr* mgr)
// TESTING SDL
// Send phys sendState msg to object's plPhysicalSDLModifier
//
bool plPXPhysical::DirtySynchState(const char* SDLStateName, uint32_t synchFlags )
bool plPXPhysical::DirtySynchState(const plString& SDLStateName, uint32_t synchFlags )
{
if (GetObjectKey())
{

2
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.h

@ -210,7 +210,7 @@ protected:
/////////////////////////////////////////////////////////////
/** Remember that we need to do a synch soon. */
bool DirtySynchState(const char* SDLStateName, uint32_t synchFlags );
bool DirtySynchState(const plString& SDLStateName, uint32_t synchFlags);
double GetLastSyncTime() { return fLastSyncTime; }

2
Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h

@ -173,7 +173,7 @@ public:
// NEVER!
// If you think it should... talk to Bob. He will explain why it can't be, and beat you up.
// If he can't remember, beat him up until he does (or ask Moose).
virtual bool DirtySynchState(const char* sdlName, uint32_t sendFlags) { return false; } // don't send link state
virtual bool DirtySynchState(const plString& sdlName, uint32_t sendFlags) { return false; } // don't send link state
virtual void Read(hsStream* s, hsResMgr* mgr);
virtual void Write(hsStream* s, hsResMgr* mgr);

4
Sources/Tools/MaxMain/plMaxNode.cpp

@ -455,7 +455,7 @@ void plMaxNode::CheckSynchOptions(plSynchedObject* so)
if (gUserPropMgr.GetUserPropStringList(this, "DontPersist", num, sdataList))
{
for(i=0;i<num;i++)
so->AddToSDLExcludeList(sdataList[i]); // disable a type of persistence
so->AddToSDLExcludeList((const char *)sdataList[i]); // disable a type of persistence
}
}
@ -469,7 +469,7 @@ void plMaxNode::CheckSynchOptions(plSynchedObject* so)
if (gUserPropMgr.GetUserPropStringList(this, "Volatile", num, sdataList))
{
for(i=0;i<num;i++)
so->AddToSDLVolatileList(sdataList[i]); // make volatile a type of persistence
so->AddToSDLVolatileList((const char *)sdataList[i]); // make volatile a type of persistence
}
}

Loading…
Cancel
Save