diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp index 4b321bc4..eb49b96b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp @@ -398,4 +398,4 @@ void pyMarkerGame::AddPlasmaMethods(std::vector& methods) { PYTHON_GLOBAL_METHOD(methods, PtIsMarkerGame); PYTHON_GLOBAL_METHOD_WKEY(methods, PtCreateMarkerGame); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp index 3b5a811d..b1153236 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp @@ -42,6 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include "../pyKey.h" +#include "plString.h" #pragma hdrstop #include "pyGameCli.h" @@ -81,9 +82,9 @@ PyObject* pyGameCli::GetGameCli(unsigned gameID) PYTHON_RETURN_NONE; } -std::wstring pyGameCli::GetGameNameByTypeID(std::wstring typeID) +std::wstring pyGameCli::GetGameNameByTypeID(plString& typeID) { - Uuid gameUuid(typeID.c_str()); + plUUID gameUuid(typeID); return pfGameMgr::GetInstance()->GetGameNameByTypeId(gameUuid); } @@ -99,15 +100,13 @@ unsigned pyGameCli::GameID() const return 0; } -std::wstring pyGameCli::GameTypeID() const +plUUID pyGameCli::GameTypeID() const { if (gameClient) { - wchar_t guidStr[64]; - wcsncpy(guidStr, plUUID(gameClient->GetGameTypeId()).AsString().ToWchar(), 64); - return guidStr; + return plUUID(gameClient->GetGameTypeId()); } - return L""; + return plUUID(); } std::wstring pyGameCli::Name() const diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h index b3f4999c..db9dad4e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h @@ -52,8 +52,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "../pyGlueHelpers.h" #include #include +#include "pnUUID/pnUUID.h" class pfGameCli; +class plString; class pyGameCli { @@ -76,11 +78,11 @@ public: static std::vector GetGameIDs(); static PyObject* GetGameCli(unsigned gameID); // returns a ptGameCli - static std::wstring GetGameNameByTypeID(std::wstring typeID); + static std::wstring GetGameNameByTypeID(plString& typeID); static void JoinGame(pyKey& callbackKey, unsigned gameID); unsigned GameID() const; - std::wstring GameTypeID() const; + plUUID GameTypeID() const; std::wstring Name() const; unsigned PlayerCount() const; diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp index 9cb7e7d0..c0d3b37d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp @@ -84,31 +84,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetGameNameByTypeID, args, "Params: guid\nRetu PyObject* textObj; if (!PyArg_ParseTuple(args, "O", &textObj)) { - PyErr_SetString(PyExc_TypeError, "PtGetGameNameByTypeID expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtGetGameNameByTypeID expects a string"); PYTHON_RETURN_ERROR; } - if (PyUnicode_Check(textObj)) - { - int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = new wchar_t[strLen + 1]; - PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); - text[strLen] = L'\0'; - std::wstring retVal = pyGameCli::GetGameNameByTypeID(text); - delete [] text; - return PyUnicode_FromWideChar(retVal.c_str(), retVal.length()); - } - else if (PyString_Check(textObj)) + + if (PyString_CheckEx(textObj)) { - // we'll allow this, just in case something goes weird - char* text = PyString_AsString(textObj); - wchar_t* wText = hsStringToWString(text); - std::wstring retVal = pyGameCli::GetGameNameByTypeID(wText); - delete [] wText; + plString guid = PyString_AsStringEx(textObj); + + std::wstring retVal = pyGameCli::GetGameNameByTypeID(guid); return PyUnicode_FromWideChar(retVal.c_str(), retVal.length()); } else { - PyErr_SetString(PyExc_TypeError, "PtGetGameNameByTypeID expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtGetGameNameByTypeID expects a string"); PYTHON_RETURN_ERROR; } } @@ -139,8 +128,8 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptGameCli, gameID) PYTHON_METHOD_DEFINITION_NOARGS(ptGameCli, gameTypeID) { - std::wstring retVal = self->fThis->GameTypeID(); - return PyUnicode_FromWideChar(retVal.c_str(), retVal.length()); + plUUID retVal = self->fThis->GameTypeID(); + return PyString_FromPlString(retVal.AsString()); } PYTHON_METHOD_DEFINITION_NOARGS(ptGameCli, name) @@ -255,4 +244,4 @@ void pyGameCli::AddPlasmaMethods(std::vector& methods) PYTHON_GLOBAL_METHOD(methods, PtGetGameCli); PYTHON_GLOBAL_METHOD(methods, PtGetGameNameByTypeID); PYTHON_GLOBAL_METHOD(methods, PtJoinGame); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp index b328a6a8..f4002871 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp @@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyGameMgrMsg.h" #include "pfGameMgr/pfGameMgr.h" +#include "pnUUID/pnUUID.h" /////////////////////////////////////////////////////////////////////////////// // @@ -93,7 +94,7 @@ pyGameMgrInviteReceivedMsg::pyGameMgrInviteReceivedMsg(pfGameMgrMsg* msg): pyGam message = nil; // wrong type, just clear it out } -unsigned long pyGameMgrInviteReceivedMsg::InviterID() const +uint32_t pyGameMgrInviteReceivedMsg::InviterID() const { if (message) { @@ -103,19 +104,17 @@ unsigned long pyGameMgrInviteReceivedMsg::InviterID() const return 0; } -std::wstring pyGameMgrInviteReceivedMsg::GameTypeID() const +plUUID pyGameMgrInviteReceivedMsg::GameTypeID() const { if (message) { const Srv2Cli_GameMgr_InviteReceived* gmMsg = (const Srv2Cli_GameMgr_InviteReceived*)message->netMsg; - wchar_t buffer[64]; - wcsncpy(buffer, plUUID(gmMsg->gameTypeId).AsString().ToWchar(), 64); - return buffer; + return plUUID(gmMsg->gameTypeId); } - return L""; + return plUUID(); } -unsigned long pyGameMgrInviteReceivedMsg::NewGameID() const +uint32_t pyGameMgrInviteReceivedMsg::NewGameID() const { if (message) { @@ -134,7 +133,7 @@ pyGameMgrInviteRevokedMsg::pyGameMgrInviteRevokedMsg(pfGameMgrMsg* msg): pyGameM message = nil; // wrong type, just clear it out } -unsigned long pyGameMgrInviteRevokedMsg::InviterID() const +uint32_t pyGameMgrInviteRevokedMsg::InviterID() const { if (message) { @@ -144,19 +143,17 @@ unsigned long pyGameMgrInviteRevokedMsg::InviterID() const return 0; } -std::wstring pyGameMgrInviteRevokedMsg::GameTypeID() const +plUUID pyGameMgrInviteRevokedMsg::GameTypeID() const { if (message) { const Srv2Cli_GameMgr_InviteRevoked* gmMsg = (const Srv2Cli_GameMgr_InviteRevoked*)message->netMsg; - wchar_t buffer[64]; - wcsncpy(buffer, plUUID(gmMsg->gameTypeId).AsString().ToWchar(), 64); - return buffer; + return plUUID(gmMsg->gameTypeId); } - return L""; + return plUUID(); } -unsigned long pyGameMgrInviteRevokedMsg::NewGameID() const +uint32_t pyGameMgrInviteRevokedMsg::NewGameID() const { if (message) { diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h index 288eb117..0a81b6cc 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h @@ -53,6 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include class pfGameMgrMsg; +class plUUID; class pyGameMgrMsg { @@ -95,9 +96,9 @@ public: static void AddPlasmaClasses(PyObject* m); - unsigned long InviterID() const; - std::wstring GameTypeID() const; - unsigned long NewGameID() const; + uint32_t InviterID() const; + plUUID GameTypeID() const; + uint32_t NewGameID() const; }; /////////////////////////////////////////////////////////////////////////////// @@ -116,9 +117,9 @@ public: static void AddPlasmaClasses(PyObject* m); - unsigned long InviterID() const; - std::wstring GameTypeID() const; - unsigned long NewGameID() const; + uint32_t InviterID() const; + plUUID GameTypeID() const; + uint32_t NewGameID() const; }; #endif // pyGameMgrMsg_h diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsgGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsgGlue.cpp index fd0ade26..41125ac0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsgGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsgGlue.cpp @@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyGameMgrMsg.h" #include "pfGameMgr/pfGameMgr.h" +#include "pnUUID/pnUUID.h" #include "../pyEnum.h" /////////////////////////////////////////////////////////////////////////////// @@ -130,8 +131,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteReceivedMsg, inviterID) PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteReceivedMsg, gameTypeID) { - std::wstring retVal = self->fThis->GameTypeID(); - return PyUnicode_FromWideChar(retVal.c_str(), retVal.length()); + return PyString_FromString(self->fThis->GameTypeID().AsString().c_str()); } PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteReceivedMsg, newGameID) @@ -183,8 +183,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteRevokedMsg, inviterID) PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteRevokedMsg, gameTypeID) { - std::wstring retVal = self->fThis->GameTypeID(); - return PyUnicode_FromWideChar(retVal.c_str(), retVal.length()); + return PyString_FromString(self->fThis->GameTypeID().AsString().c_str()); } PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteRevokedMsg, newGameID) @@ -219,4 +218,4 @@ void pyGameMgrInviteRevokedMsg::AddPlasmaClasses(PyObject* m) PYTHON_CLASS_IMPORT_START(m); PYTHON_CLASS_IMPORT(m, ptGameMgrInviteRevokedMsg); PYTHON_CLASS_IMPORT_END(m); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h index f89b6d58..0293e2d4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h @@ -42,6 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef cyMisc_h #define cyMisc_h +#include + ///////////////////////////////////////////////////////////////////////////// // // NAME: cyMisc diff --git a/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp b/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp index f0ba7276..4de701e1 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp @@ -906,7 +906,8 @@ PyObject *ptImportHook_load_module_detail(ptImportHook *self, char* module_name, PyObject* modules = PyImport_GetModuleDict(); hsAssert(PyDict_Check(modules), "sys.modules is not a dict"); - if (result = PyDict_GetItemString(modules, module_name)) + result = PyDict_GetItemString(modules, module_name); + if (result) { if (!PyModule_Check(result)) { diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp index 66d86adb..57b012ed 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp @@ -47,8 +47,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////////// -#include #include +#include #include "HeadSpin.h" #include "plgDispatch.h" #include "pyGeometry3.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp b/Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp index cda95b17..d2067b24 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp @@ -107,7 +107,7 @@ static int EnumValue_print(PyObject *self, FILE *fp, int flags) if (text == NULL) return -1; - fprintf(fp, text); // and print it to the file + fprintf(fp, "%s", text); // and print it to the file return 0; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDraggable.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDraggable.cpp index daba25fb..647171b6 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDraggable.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDraggable.cpp @@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ +#include #include "pyKey.h" #pragma hdrstop diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.cpp index bf26244f..cf9211a7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.cpp @@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ +#include #include "pyKey.h" #pragma hdrstop diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp index 5620be3e..6ac0681a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp @@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ +#include #include "pyKey.h" #pragma hdrstop diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNotifyGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNotifyGlue.cpp index 1cbe3340..e23e931f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNotifyGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyNotifyGlue.cpp @@ -210,14 +210,14 @@ PYTHON_METHOD_DEFINITION(ptNotify, addVarNumber, args) if (number == NULL || number == Py_None) self->fThis->AddVarNull(name); else if (PyInt_Check(number)) - self->fThis->AddVarNumber(name, PyInt_AsLong(number)); + self->fThis->AddVarNumber(name, (int)PyInt_AsLong(number)); else if (PyLong_Check(number)) { // try as int first long i = PyLong_AsLong(number); if (!PyErr_Occurred()) { - self->fThis->AddVarNumber(name, i); + self->fThis->AddVarNumber(name, (int)i); } else { @@ -493,4 +493,4 @@ void pyNotify::AddPlasmaConstantsClasses(PyObject *m) PYTHON_ENUM_ELEMENT(PtMultiStageEventType, kAdvanceNextStage, proEventData::kAdvanceNextStage); PYTHON_ENUM_ELEMENT(PtMultiStageEventType, kRegressPrevStage, proEventData::kRegressPrevStage); PYTHON_ENUM_END(m, PtMultiStageEventType); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp index f071ada3..5e911472 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp @@ -58,6 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyNetLinkingMgr.h" #include "pyAgeInfoStruct.h" +#include "pnUUID/pnUUID.h" #include "plVault/plVault.h" // should only be created from C++ side @@ -228,16 +229,14 @@ void pyVaultAgeInfoNode::SetAgeUserDefinedName( const char * v ) { } -const char * pyVaultAgeInfoNode::GetAgeInstanceGuid() const +plUUID pyVaultAgeInfoNode::GetAgeInstanceGuid() const { - fAgeInstGuid[0] = 0; - if (fNode) { VaultAgeInfoNode access(fNode); - strncpy(fAgeInstGuid, plUUID(access.ageInstUuid).AsString().c_str(), 64); + return plUUID(access.ageInstUuid); } - return fAgeInstGuid; + return plUUID(); } void pyVaultAgeInfoNode::SetAgeInstanceGuid( const char * sguid ) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h index 1e609a8b..4f8df130 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h @@ -56,12 +56,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com struct RelVaultNode; class pyVaultSDLNode; class pyAgeInfoStruct; +class plUUID; class pyVaultAgeInfoNode : public pyVaultNode { private: - mutable char fAgeInstGuid[64]; mutable std::string fAgeFilename; mutable std::string fAgeInstName; mutable std::string fAgeUserName; @@ -105,7 +105,7 @@ public: const char * GetAgeUserDefinedName() const; void SetAgeUserDefinedName( const char * v ); - const char * GetAgeInstanceGuid() const; + plUUID GetAgeInstanceGuid() const; void SetAgeInstanceGuid( const char * guid ); const char * GetAgeDescription() const; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNodeGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNodeGlue.cpp index a7b6a0a2..bd8b0657 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNodeGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNodeGlue.cpp @@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyVaultAgeInfoNode.h" #include "plVault/plVault.h" +#include "pnUUID/pnUUID.h" // glue functions PYTHON_CLASS_DEFINITION(ptVaultAgeInfoNode, pyVaultAgeInfoNode); @@ -147,7 +148,7 @@ PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeUserDefinedName, args) PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, getAgeInstanceGuid) { - return PyString_FromString(self->fThis->GetAgeInstanceGuid()); + return PyString_FromPlString(self->fThis->GetAgeInstanceGuid().AsString()); } PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeInstanceGuid, args) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.h index b9c91aa2..0b21c24b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.h @@ -64,8 +64,6 @@ class pySpawnPointInfoRef; class pyVaultAgeLinkNode : public pyVaultNode { private: - mutable std::string fAgeGuidStr; // for getting Age GUID - mutable plAgeLinkStruct fAgeLinkStruct; // for use with AsAgeLinkStruct() protected: diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp index 21d1303f..4c2cd6d6 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp @@ -192,10 +192,11 @@ void pyVaultImageNode::Image_SetImage(pyImage& image) fMipmap = nil; } - if (fMipmap = image.GetImage()) { + fMipmap = image.GetImage(); + if (fMipmap) { VaultImageNode access(fNode); access.StuffImage(fMipmap); - + fMipmapKey = image.GetKey(); if (!fMipmapKey) fMipmapKey = CreateAndRefImageKey(fNode->nodeId, fMipmap); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp index fab28e10..965bb559 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp @@ -49,6 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyVaultMarkerGameNode.h" #include "plVault/plVault.h" +#include "pnUUID/pnUUID.h" // should only be created from C++ side pyVaultMarkerGameNode::pyVaultMarkerGameNode(RelVaultNode* nfsNode) @@ -88,15 +89,13 @@ void pyVaultMarkerGameNode::SetGameName (const char v[]) } } -const char * pyVaultMarkerGameNode::GetGameGuid () const +plUUID pyVaultMarkerGameNode::GetGameGuid() const { - fGameGuid[0] = 0; - if (fNode) { VaultMarkerGameNode access(fNode); - strncpy(fGameGuid, plUUID(access.gameGuid).AsString().c_str(), 64); + return plUUID(access.gameGuid); } - return fGameGuid; + return plUUID(); } void pyVaultMarkerGameNode::SetGameGuid (const char v[]) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h index a06b59f3..4b23040c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h @@ -56,12 +56,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnNetBase/pnNetBase.h" struct RelVaultNode; +class plUUID; class pyVaultMarkerGameNode : public pyVaultNode { private: mutable char fGameName[kMaxVaultNodeStringLength]; - mutable char fGameGuid[64]; protected: // should only be created from C++ side @@ -86,7 +86,7 @@ public: const char * GetGameName () const; void SetGameName (const char v[]); - const char * GetGameGuid () const; + plUUID GetGameGuid() const; void SetGameGuid (const char v[]); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNodeGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNodeGlue.cpp index 1dc86e1e..1edaa5f2 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNodeGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNodeGlue.cpp @@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyVaultMarkerGameNode.h" #include "plVault/plVault.h" +#include "pnUUID/pnUUID.h" // glue functions PYTHON_CLASS_DEFINITION(ptVaultMarkerGameNode, pyVaultMarkerGameNode); @@ -84,7 +85,7 @@ PYTHON_METHOD_DEFINITION(ptVaultMarkerGameNode, setGameName, args) PYTHON_METHOD_DEFINITION_NOARGS(ptVaultMarkerGameNode, getGameGuid) { - return PyString_FromString(self->fThis->GetGameGuid()); + return PyString_FromPlString(self->fThis->GetGameGuid().AsString()); } PYTHON_METHOD_DEFINITION(ptVaultMarkerGameNode, setGameGuid, args) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp index 0a54d312..710af162 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp @@ -45,33 +45,36 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include #include +#include #pragma hdrstop #include "pyVaultNode.h" + #ifndef BUILDING_PYPLASMA # include "pyVault.h" # include "pyVaultSystemNode.h" # include "pnNetCommon/plNetApp.h" # include "plNetClientComm/plNetClientComm.h" #endif -# include "pyImage.h" -# include "pyDniCoordinates.h" -# include "pyVaultNodeRef.h" -# include "pyVaultFolderNode.h" -# include "pyVaultPlayerInfoListNode.h" -# include "pyVaultImageNode.h" -# include "pyVaultTextNoteNode.h" -# include "pyVaultAgeLinkNode.h" -# include "pyVaultChronicleNode.h" -# include "pyVaultPlayerInfoNode.h" -# include "pyVaultMarkerGameNode.h" -# include "pyVaultAgeInfoNode.h" -# include "pyVaultAgeInfoListNode.h" -# include "pyVaultPlayerNode.h" -# include "pyVaultSDLNode.h" +#include "pyImage.h" +#include "pyDniCoordinates.h" +#include "pyVaultNodeRef.h" +#include "pyVaultFolderNode.h" +#include "pyVaultPlayerInfoListNode.h" +#include "pyVaultImageNode.h" +#include "pyVaultTextNoteNode.h" +#include "pyVaultAgeLinkNode.h" +#include "pyVaultChronicleNode.h" +#include "pyVaultPlayerInfoNode.h" +#include "pyVaultMarkerGameNode.h" +#include "pyVaultAgeInfoNode.h" +#include "pyVaultAgeInfoListNode.h" +#include "pyVaultPlayerNode.h" +#include "pyVaultSDLNode.h" + +#include "pnUUID/pnUUID.h" #include "plGImage/plMipmap.h" #include "plVault/plVault.h" @@ -168,7 +171,6 @@ RelVaultNode * pyVaultNode::pyVaultNodeOperationCallback::GetNode () { // only for python glue, do NOT call pyVaultNode::pyVaultNode() : fNode(nil) -, fCreateAgeGuid(nil) , fCreateAgeName(nil) { } @@ -176,7 +178,6 @@ pyVaultNode::pyVaultNode() // should only be created from C++ side pyVaultNode::pyVaultNode( RelVaultNode* nfsNode ) : fNode(nfsNode) -, fCreateAgeGuid(nil) , fCreateAgeName(nil) { if (fNode) @@ -187,7 +188,6 @@ pyVaultNode::~pyVaultNode() { if (fNode) fNode->DecRef("pyVaultNode"); - free(fCreateAgeGuid); free(fCreateAgeName); } @@ -322,20 +322,13 @@ const char * pyVaultNode::GetCreateAgeName( void ) return fCreateAgeName; } -const char * pyVaultNode::GetCreateAgeGuid( void ) +plUUID pyVaultNode::GetCreateAgeGuid(void) const { - if (!fNode) - return ""; - - if (fCreateAgeGuid) - return fCreateAgeGuid; - if (fNode) { - fCreateAgeGuid = (char*)malloc(64); - strncpy(fCreateAgeGuid, plUUID(fNode->createAgeUuid).AsString().c_str(), 64); + return plUUID(fNode->createAgeUuid); } - - return fCreateAgeGuid; + + return plUUID(); } PyObject* pyVaultNode::GetCreateAgeCoords () { @@ -390,9 +383,6 @@ void pyVaultNode::SetCreateAgeName( const char * v ) void pyVaultNode::SetCreateAgeGuid( const char * v ) { - free(fCreateAgeGuid); - fCreateAgeGuid = nil; - ASSERT(fNode); Uuid uuid; GuidFromString(v, &uuid); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h index e57a423b..842f3009 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h @@ -54,6 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com struct RelVaultNode; class plMipmap; class pyImage; +class plUUID; class pyDniCoordinates; @@ -97,7 +98,6 @@ public: }; RelVaultNode * fNode; - mutable char * fCreateAgeGuid; mutable char * fCreateAgeName; protected: @@ -138,7 +138,7 @@ public: uint32_t GetCreateTime( void ); uint32_t GetCreateAgeTime( void ); const char * GetCreateAgeName( void ); - const char * GetCreateAgeGuid( void ); + plUUID GetCreateAgeGuid(void) const; PyObject* GetCreateAgeCoords (); // public setters diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeGlue.cpp index 61188e86..0a417448 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeGlue.cpp @@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #pragma hdrstop #include "pyVaultNode.h" +#include "pnUUID/pnUUID.h" #include "plVault/plVault.h" // glue functions @@ -153,7 +154,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptVaultNode, getCreateAgeName) PYTHON_METHOD_DEFINITION_NOARGS(ptVaultNode, getCreateAgeGuid) { - return PyString_FromString(self->fThis->GetCreateAgeGuid()); + return PyString_FromPlString(self->fThis->GetCreateAgeGuid().AsString()); } PYTHON_METHOD_DEFINITION_NOARGS(ptVaultNode, getCreateAgeCoords) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp index 6a594976..2d3d6e3c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp @@ -45,8 +45,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include #include +#include #pragma hdrstop #include "pyVaultPlayerInfoListNode.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp index f75dabcb..8c15ffd8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp @@ -49,6 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyVaultPlayerInfoNode.h" #include "plVault/plVault.h" +#include "pnUUID/pnUUID.h" #ifndef BUILDING_PYPLASMA # include "pyVault.h" #endif @@ -158,15 +159,13 @@ void pyVaultPlayerInfoNode::Player_SetAgeGuid( const char * guidtext) playerInfo.SetAgeInstUuid(ageInstId); } -const char * pyVaultPlayerInfoNode::Player_GetAgeGuid( void ) +plUUID pyVaultPlayerInfoNode::Player_GetAgeGuid(void) const { - if (!fNode) - return ""; - - VaultPlayerInfoNode playerInfo(fNode); - - strncpy(ansiAgeInstUuid, plUUID(playerInfo.ageInstUuid).AsString().c_str(), 64); - return ansiAgeInstUuid; + if (fNode) { + VaultPlayerInfoNode playerInfo(fNode); + return plUUID(playerInfo.ageInstUuid); + } + return plUUID(); } // online status diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h index 2415c17f..8468ca5b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h @@ -51,11 +51,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyVaultNode.h" #include "pyGlueHelpers.h" +class plUUID; + class pyVaultPlayerInfoNode : public pyVaultNode { mutable char * ansiPlayerName; mutable char * ansiAgeInstName; - mutable char ansiAgeInstUuid[64]; protected: // should only be created from C++ side @@ -88,7 +89,7 @@ public: void Player_SetAgeInstanceName( const char * agename ); const char * Player_GetAgeInstanceName( void ); void Player_SetAgeGuid( const char * guidtext); - const char * Player_GetAgeGuid( void ); + plUUID Player_GetAgeGuid(void) const; // online status void Player_SetOnline( bool b ); bool Player_IsOnline( void ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp index 25f7114c..8238a18b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp @@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #pragma hdrstop #include "pyVaultPlayerInfoNode.h" +#include "pnUUID/pnUUID.h" #include "plVault/plVault.h" // glue functions @@ -122,7 +123,7 @@ PYTHON_METHOD_DEFINITION(ptVaultPlayerInfoNode, playerSetAgeGuid, args) PYTHON_METHOD_DEFINITION_NOARGS(ptVaultPlayerInfoNode, playerGetAgeGuid) { - return PyString_FromString(self->fThis->Player_GetAgeGuid()); + return PyString_FromPlString(self->fThis->Player_GetAgeGuid().AsString()); } PYTHON_METHOD_DEFINITION(ptVaultPlayerInfoNode, playerSetOnline, args)