From fd8541e18dee92459d335fa7e1dafeef0cb5806c Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 18 Nov 2012 16:41:33 -0800 Subject: [PATCH 1/8] Get rid of GuidGenerate calls. --- .../pfConsole/pfConsoleCommandsNet.cpp | 4 +-- Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp | 12 ++++---- .../Plasma/FeatureLib/pfPython/pyVault.cpp | 2 +- .../pnNetProtocol/Private/pnNpCommon.cpp | 6 ++-- Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp | 28 ++++++++++--------- .../NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp | 10 ------- .../Plasma/NucleusLib/pnUtils/pnUtUuid.cpp | 26 ----------------- Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h | 4 --- .../plInputCore/plSceneInputInterface.cpp | 4 +-- .../plNetClient/plNetLinkingMgr.cpp | 6 ++-- .../plNetGameLib/Private/plNglAuth.cpp | 2 +- 11 files changed, 32 insertions(+), 72 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp index 11cc95e0..ac7a72b1 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp @@ -810,7 +810,7 @@ PF_CONSOLE_CMD( Net_Vault, plAgeLinkStruct link; link.GetAgeInfo()->SetAgeFilename( params[0] ); link.GetAgeInfo()->SetAgeInstanceName( params[0] ); - plUUID guid(GuidGenerate()); + plUUID guid = plUUID::Generate(); link.GetAgeInfo()->SetAgeInstanceGuid( &guid); link.SetSpawnPoint( kDefaultSpawnPoint ); bool success = VaultRegisterOwnedAgeAndWait(&link); @@ -838,7 +838,7 @@ PF_CONSOLE_CMD( Net_Vault, plAgeLinkStruct link; link.GetAgeInfo()->SetAgeFilename( params[0] ); link.GetAgeInfo()->SetAgeInstanceName( params[0] ); - plUUID guid(GuidGenerate()); + plUUID guid = plUUID::Generate(); link.GetAgeInfo()->SetAgeInstanceGuid( &guid); link.SetSpawnPoint( kDefaultSpawnPoint ); bool success = VaultRegisterOwnedAgeAndWait(&link); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp index 1179dfb4..c7eb6341 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp @@ -2828,12 +2828,12 @@ void cyMisc::SendFriendInvite(const wchar_t email[], const wchar_t toName[]) if (RelVaultNode* pNode = VaultGetPlayerNodeIncRef()) { VaultPlayerNode player(pNode); - Uuid inviteUuid = player.inviteUuid; + plUUID inviteUuid(player.inviteUuid); // If we don't have an invite UUID set then make a new one - if (GuidIsNil(inviteUuid)) + if (inviteUuid.IsNull()) { - inviteUuid = GuidGenerate(); + inviteUuid = plUUID::Generate(); player.SetInviteUuid(inviteUuid); } @@ -2844,11 +2844,9 @@ void cyMisc::SendFriendInvite(const wchar_t email[], const wchar_t toName[]) PyObject* cyMisc::PyGuidGenerate() { - char guidStr[64]; - Uuid newGuid = GuidGenerate(); - GuidToString(newGuid, guidStr, arrsize(guidStr)); + plUUID newGuid = plUUID::Generate(); - return PyString_FromString(guidStr); + return PyString_FromString(newGuid.AsString().c_str()); } PyObject* cyMisc::GetAIAvatarsByModelName(const char* name) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp index 82284a3c..73a38b6d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp @@ -671,7 +671,7 @@ void pyVault::CreateNeighborhood() desc = plString::Format( "%s's %s", nc->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() ); } - plUUID guid(GuidGenerate()); + plUUID guid = plUUID::Generate(); link.GetAgeInfo()->SetAgeInstanceGuid(&guid); link.GetAgeInfo()->SetAgeUserDefinedName( title.c_str() ); link.GetAgeInfo()->SetAgeDescription( desc.c_str() ); diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp index b82ee37d..a48aa22f 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp @@ -976,9 +976,9 @@ void NetVaultNodeFieldArray::GetFieldValueString_LCS ( case NetVaultNode::kUuid_2: case NetVaultNode::kUuid_3: case NetVaultNode::kUuid_4: { - wchar_t tmp[64]; - GuidToHex(*(Uuid *)fieldAddr, tmp, arrsize(tmp)); - StrPrintf(dst, dstChars, L"hextoraw('%s')", tmp); + plString tmp = plUUID(fieldAddr).AsString(); + + StrPrintf(dst, dstChars, L"hextoraw('%s')", tmp.c_str()); } break; diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp index 32beab3f..e9609ed4 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp @@ -47,44 +47,46 @@ plUUID::plUUID() Clear(); } -plUUID::plUUID( const plString & s ) +plUUID::plUUID(const plString & s) { - FromString( s ); + FromString(s); } -plUUID::plUUID( const char * s ) +plUUID::plUUID(const char * s) { - FromString( s ); + FromString(s.c_str()); } -plUUID::plUUID( const plUUID & other ) +plUUID::plUUID(const plUUID& other) { - CopyFrom( &other ); + CopyFrom(&other); } -plUUID::plUUID( const Uuid & uuid ) +plUUID::plUUID(const Uuid& uuid) { memcpy(fData, uuid.data, sizeof(fData)); } -void plUUID::Read( hsStream * s) +void plUUID::Read(hsStream * s) { s->LogSubStreamPushDesc("plUUID"); - s->Read( sizeof( fData ), (void*)fData ); + s->Read(sizeof(fData), (void*)fData); } -void plUUID::Write( hsStream * s) +void plUUID::Write(hsStream * s) { - s->Write( sizeof( fData ), (const void*)fData ); + s->Write(sizeof(fData), (const void*)fData); } -plString plUUID::AsString() const { +plString plUUID::AsString() const +{ plString str; ToString(str); return str; } -plUUID::operator Uuid () const { +plUUID::operator Uuid () const +{ Uuid uuid; memcpy(uuid.data, fData, sizeof(uuid.data)); return uuid; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp b/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp index acd519d8..841ab634 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp @@ -120,17 +120,7 @@ Uuid Uuid::Generate() static_assert(sizeof(Uuid) >= sizeof(GUID), "pnUtils Uuid and Win32 GUID types differ in size"); -//============================================================================ -Uuid GuidGenerate () { - Uuid result; - UuidCreate( (GUID *)&result ); - return result; -} -//============================================================================ -void GuidClear (Uuid * uuid) { - UuidCreateNil((GUID *)uuid); -} //============================================================================ bool GuidFromString (const wchar_t str[], Uuid * uuid) { diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp index c5f31c32..ff3da241 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp @@ -71,32 +71,6 @@ Uuid::Uuid (const uint8_t buf[], unsigned length) { GuidFromHex(buf, length, this); } -//============================================================================ -unsigned GuidHash (const Uuid & uuid) { - - CHashValue hash(&uuid.data, sizeof(uuid.data)); - return hash.GetHash(); -} - -//============================================================================ -static const wchar_t s_hexChars[] = L"0123456789ABCDEF"; -const wchar_t * GuidToHex (const Uuid & uuid, wchar_t * dst, unsigned chars) { - - wchar_t * str = (wchar_t*)malloc((sizeof(uuid.data) * 2 + 1) * sizeof(wchar_t)); - wchar_t * cur = str; - - for (unsigned i = 0; i < sizeof(uuid.data); ++i) { - *cur++ = s_hexChars[(uuid.data[i] >> 4) & 0x0f]; - *cur++ = s_hexChars[uuid.data[i] & 0x0f]; - } - *cur = 0; - - StrCopy(dst, str, chars); - - free(str); - return dst; -} - //============================================================================ bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid) { diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h index 875adcf9..515d48cd 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h @@ -75,17 +75,13 @@ extern const Uuid kNilGuid; // Using 'Guid' here instead of 'Uuid' to avoid name clash with windows API =( -Uuid GuidGenerate (); -void GuidClear (Uuid * uuid); bool GuidFromString (const wchar_t str[], Uuid * uuid); bool GuidFromString (const char str[], Uuid * uuid); int GuidCompare (const Uuid & a, const Uuid & b); inline bool GuidsAreEqual (const Uuid & a, const Uuid & b) { return 0 == GuidCompare(a, b); } bool GuidIsNil (const Uuid & uuid); -unsigned GuidHash (const Uuid & uuid); const wchar_t * GuidToString (const Uuid & uuid, wchar_t * dst, unsigned chars); // returns dst const char * GuidToString (const Uuid & uuid, char * dst, unsigned chars); // returns dst -const wchar_t * GuidToHex (const Uuid & uuid, wchar_t * dst, unsigned chars); // returns dst bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp index cb4787f6..eb928ccf 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp @@ -833,7 +833,7 @@ void plSceneInputInterface::ILinkOffereeToAge() else if (!VaultGetOwnedAgeLink(&info, &link)) { // We must have an owned copy of the age before we can offer it, so make one now - plUUID guid(GuidGenerate()); + plUUID guid = plUUID::Generate(); info.SetAgeInstanceGuid(&guid); plString title, desc; @@ -861,7 +861,7 @@ void plSceneInputInterface::ILinkOffereeToAge() VaultAgeLinkNode linkAcc(linkNode); if (linkAcc.volat) { if (VaultUnregisterOwnedAgeAndWait(link.GetAgeInfo())) { - plUUID guid(GuidGenerate()); + plUUID guid = plUUID::Generate(); link.GetAgeInfo()->SetAgeInstanceGuid(&guid); VaultRegisterOwnedAgeAndWait(&link); } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index cfaa2077..3948eae6 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -920,7 +920,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) // BASIC LINK. Link to a unique instance of the age, if no instance specified. case plNetCommon::LinkingRules::kBasicLink: if (!info->HasAgeInstanceGuid()) { - plUUID newuuid(GuidGenerate()); + plUUID newuuid = plUUID::Generate(); info->SetAgeInstanceGuid(&newuuid); } break; @@ -961,7 +961,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) info->SetAgeDescription(desc.c_str()); } if (!info->HasAgeInstanceGuid()) { - plUUID newuuid(GuidGenerate()); + plUUID newuuid = plUUID::Generate(); info->SetAgeInstanceGuid(&newuuid); } @@ -1002,7 +1002,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) } if (!info->HasAgeInstanceGuid()) { - plUUID newuuid(GuidGenerate()); + plUUID newuuid = plUUID::Generate(); info->SetAgeInstanceGuid(&newuuid); } diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp index 4a28fddb..a6fa421e 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp @@ -5624,7 +5624,7 @@ unsigned NetCliAuthVaultNodeSave ( node->dirtyFlags |= NetVaultNode::kNodeType; // We're definitely saving this node, so assign a revisionId - node->revisionId = GuidGenerate(); + node->revisionId = (Uuid)plUUID::Generate(); ARRAY(uint8_t) buffer; unsigned bytes = node->Write_LCS(&buffer, NetVaultNode::kRwDirtyOnly | NetVaultNode::kRwUpdateDirty); From 517d4f6788a7a1fbd251affd55074391b8bb41e4 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 18 Nov 2012 20:48:36 -0800 Subject: [PATCH 2/8] Added boolean operators to plUUID. --- Sources/Plasma/NucleusLib/pnUUID/pnUUID.h | 43 ++++++++++++----------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h index 4f68e0ee..890f6294 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h @@ -55,30 +55,32 @@ public: uint8_t fData[16]; struct Match { - const plUUID * fGuid; - Match( const plUUID * guid ):fGuid( guid ){} - bool operator()( const plUUID * guid ) const { return guid->IsEqualTo( fGuid );} + const plUUID* fGuid; + Match(const plUUID* guid) : fGuid(guid) {} + bool operator()(const plUUID* guid) const { return guid->IsEqualTo(fGuid); } }; plUUID(); - plUUID( const char * s ); - plUUID( const plString & s ); - plUUID( const plUUID & other ); - plUUID( const Uuid & uuid ); - void Clear(); - bool IsNull() const; - bool IsSet() const { return !IsNull(); } - void CopyFrom( const plUUID * v ); - void CopyFrom( const plUUID & v ); - int CompareTo( const plUUID * v ) const; - bool IsEqualTo( const plUUID * v ) const; - bool FromString( const char * str ); - bool FromString( const plString & str ) { return FromString( str.c_str() ); } - bool ToString( plString & out ) const; + plUUID(const plString& s); + plUUID(const plUUID& other); + plUUID(const Uuid& uuid); + + void Clear(); + bool IsNull() const; + bool IsSet() const { return !IsNull(); } + void CopyFrom(const plUUID* v); + void CopyFrom(const plUUID& v); + int CompareTo(const plUUID* v) const; + bool IsEqualTo(const plUUID* v) const; + bool FromString(const char* str); + bool FromString(const plString& str) { return FromString(str.c_str()); } + bool ToString(plString& out) const; plString AsString() const; - void Read( hsStream * s ); - void Write( hsStream * s ); - operator plString ( void ) const { return AsString();} + void Read(hsStream* s); + void Write(hsStream* s); + + operator bool () const { return !IsNull(); } + inline bool operator ! () const { return IsNull(); } bool operator==(const plUUID& other) const { return IsEqualTo(&other); @@ -89,6 +91,7 @@ public: bool operator<(const plUUID& other) const { return CompareTo(&other) == -1; } + operator plString (void) const { return AsString(); } operator Uuid () const; static plUUID Generate(); From 274812c057510f3ecc97e1293212f78c2ef2040b Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 15 Dec 2012 21:33:14 -0800 Subject: [PATCH 3/8] Remove all uses of GuidToString. --- .../FeatureLib/pfPython/Games/pyGameCli.cpp | 6 ++--- .../pfPython/Games/pyGameMgrMsg.cpp | 10 +++---- .../Plasma/FeatureLib/pfPython/pyAgeVault.h | 2 +- .../FeatureLib/pfPython/pyDniInfoSource.h | 2 +- .../pfPython/pyVaultAgeInfoNode.cpp | 3 ++- .../pfPython/pyVaultMarkerGameNode.cpp | 2 +- .../FeatureLib/pfPython/pyVaultNode.cpp | 2 +- .../pfPython/pyVaultPlayerInfoNode.cpp | 3 ++- .../pfPython/pyVaultPlayerInfoNode.h | 2 +- .../Plasma/NucleusLib/pnUUID/CMakeLists.txt | 6 +++-- Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp | 11 +++----- .../Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp | 8 ------ .../NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp | 2 +- .../NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp | 26 ------------------- .../Plasma/NucleusLib/pnUtils/pnUtUuid.cpp | 14 ---------- Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h | 4 --- .../plNetClientComm/plNetClientComm.cpp | 11 +++++--- .../PubUtilLib/plVault/plVaultNodeAccess.cpp | 4 +-- 18 files changed, 34 insertions(+), 84 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp index b810777f..3b5a811d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp @@ -103,8 +103,8 @@ std::wstring pyGameCli::GameTypeID() const { if (gameClient) { - wchar_t guidStr[256]; - GuidToString(gameClient->GetGameTypeId(), guidStr, arrsize(guidStr)); + wchar_t guidStr[64]; + wcsncpy(guidStr, plUUID(gameClient->GetGameTypeId()).AsString().ToWchar(), 64); return guidStr; } return L""; @@ -182,4 +182,4 @@ PyObject* pyGameCli::UpcastToVarSyncGame() if (gameClient && (gameClient->GetGameTypeId() == kGameTypeId_VarSync)) return pyVarSyncGame::New(gameClient); PYTHON_RETURN_NONE; -} \ 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 67d2fc81..b328a6a8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp @@ -108,8 +108,8 @@ std::wstring pyGameMgrInviteReceivedMsg::GameTypeID() const if (message) { const Srv2Cli_GameMgr_InviteReceived* gmMsg = (const Srv2Cli_GameMgr_InviteReceived*)message->netMsg; - wchar_t buffer[256]; - GuidToString(gmMsg->gameTypeId, buffer, arrsize(buffer)); + wchar_t buffer[64]; + wcsncpy(buffer, plUUID(gmMsg->gameTypeId).AsString().ToWchar(), 64); return buffer; } return L""; @@ -149,8 +149,8 @@ std::wstring pyGameMgrInviteRevokedMsg::GameTypeID() const if (message) { const Srv2Cli_GameMgr_InviteRevoked* gmMsg = (const Srv2Cli_GameMgr_InviteRevoked*)message->netMsg; - wchar_t buffer[256]; - GuidToString(gmMsg->gameTypeId, buffer, arrsize(buffer)); + wchar_t buffer[64]; + wcsncpy(buffer, plUUID(gmMsg->gameTypeId).AsString().ToWchar(), 64); return buffer; } return L""; @@ -164,4 +164,4 @@ unsigned long pyGameMgrInviteRevokedMsg::NewGameID() const return gmMsg->newGameId; } return 0; -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h b/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h index d3ad72a9..bce1cdc4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h @@ -82,7 +82,7 @@ public: static void AddPlasmaClasses(PyObject *m); - plUUID GetAgeGuid( void ); + plUUID GetAgeGuid(void); PyObject * GetAgeSDL() const; // returns pySDLStateDataRecord void UpdateAgeSDL( pySDLStateDataRecord & pyrec ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h b/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h index 614e5605..e143bab0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h @@ -74,7 +74,7 @@ public: // name of current age const char * GetAgeName( void ) const; // unique identifier for this age instance - plUUID GetAgeGuid( void ) const; + plUUID GetAgeGuid(void) const; }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp index 3878522b..f071ada3 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp @@ -234,7 +234,8 @@ const char * pyVaultAgeInfoNode::GetAgeInstanceGuid() const if (fNode) { VaultAgeInfoNode access(fNode); - GuidToString(access.ageInstUuid, fAgeInstGuid, arrsize(fAgeInstGuid)); + + strncpy(fAgeInstGuid, plUUID(access.ageInstUuid).AsString().c_str(), 64); } return fAgeInstGuid; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp index cfe152d0..fab28e10 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp @@ -94,7 +94,7 @@ const char * pyVaultMarkerGameNode::GetGameGuid () const if (fNode) { VaultMarkerGameNode access(fNode); - GuidToString(access.gameGuid, fGameGuid, arrsize(fGameGuid)); + strncpy(fGameGuid, plUUID(access.gameGuid).AsString().c_str(), 64); } return fGameGuid; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp index 20603fef..0a54d312 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp @@ -332,7 +332,7 @@ const char * pyVaultNode::GetCreateAgeGuid( void ) if (fNode) { fCreateAgeGuid = (char*)malloc(64); - GuidToString(fNode->createAgeUuid, fCreateAgeGuid, 64); + strncpy(fCreateAgeGuid, plUUID(fNode->createAgeUuid).AsString().c_str(), 64); } return fCreateAgeGuid; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp index 657eb588..f75dabcb 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp @@ -164,7 +164,8 @@ const char * pyVaultPlayerInfoNode::Player_GetAgeGuid( void ) return ""; VaultPlayerInfoNode playerInfo(fNode); - GuidToString(playerInfo.ageInstUuid, ansiAgeInstUuid, arrsize(ansiAgeInstUuid)); + + strncpy(ansiAgeInstUuid, plUUID(playerInfo.ageInstUuid).AsString().c_str(), 64); return ansiAgeInstUuid; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h index a7c0787c..2415c17f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h @@ -55,7 +55,7 @@ class pyVaultPlayerInfoNode : public pyVaultNode { mutable char * ansiPlayerName; mutable char * ansiAgeInstName; - mutable char ansiAgeInstUuid[256]; + mutable char ansiAgeInstUuid[64]; protected: // should only be created from C++ side diff --git a/Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt b/Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt index 2d9cb98b..9fad6e39 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt +++ b/Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt @@ -7,10 +7,12 @@ set(pnUUID_SOURCES if(WIN32) set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Win32.cpp) -else(WIN32) - set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp) endif(WIN32) +if(UNIX) + set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp) +endif(UNIX) + set(pnUUID_HEADERS pnUUID.h ) diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp index e9609ed4..ca27ff5a 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp @@ -47,12 +47,7 @@ plUUID::plUUID() Clear(); } -plUUID::plUUID(const plString & s) -{ - FromString(s); -} - -plUUID::plUUID(const char * s) +plUUID::plUUID(const plString& s) { FromString(s.c_str()); } @@ -67,13 +62,13 @@ plUUID::plUUID(const Uuid& uuid) memcpy(fData, uuid.data, sizeof(fData)); } -void plUUID::Read(hsStream * s) +void plUUID::Read(hsStream* s) { s->LogSubStreamPushDesc("plUUID"); s->Read(sizeof(fData), (void*)fData); } -void plUUID::Write(hsStream * s) +void plUUID::Write(hsStream* s) { s->Write(sizeof(fData), (const void*)fData); } diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp index 867ca85c..7cc270e7 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp @@ -126,12 +126,4 @@ plUUID plUUID::Generate() return result; } -#else - -// dummy function to prevent a linker warning complaining about no public symbols if the -// contents of the file get compiled out via pre-processor -void _preventLNK4221WarningStub() -{ -} - #endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp b/Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp index 25601fe2..9e286384 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include -COMPILER_ASSERT(sizeof(Uuid) >= sizeof(uuid_t)); +static_assert(sizeof(Uuid) >= sizeof(uuid_t), "UUID size does not match uuid_t"); #else diff --git a/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp b/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp index 841ab634..24ce023a 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp @@ -147,30 +147,4 @@ bool GuidIsNil (const Uuid & uuid) { return 1 == UuidIsNil((GUID *)&uuid, &s ); } -//============================================================================ -const wchar_t * GuidToString (const Uuid & uuid, wchar_t * dst, unsigned chars) { - wchar_t * src; - RPC_STATUS s; - s = UuidToStringW( (GUID *) &uuid, (unsigned short**)&src ); - if (RPC_S_OK == s) - StrCopy(dst, src, chars); - else - StrCopy(dst, L"", chars); - RpcStringFreeW( (unsigned short**)&src ); - return dst; -} - -//============================================================================ -const char * GuidToString (const Uuid & uuid, char * dst, unsigned chars) { - uint8_t * src; - RPC_STATUS s; - s = UuidToStringA( (GUID *) &uuid, &src ); - if (RPC_S_OK == s) - StrCopy(dst, (char *)src, chars); - else - StrCopy(dst, "", chars); - RpcStringFreeA(&src); - return dst; -} - #endif // HS_BUILD_FOR_WIN32 diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp index ff3da241..4745c3da 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp @@ -64,17 +64,3 @@ Uuid::Uuid (const wchar_t str[]) { GuidFromString(str, this); } - -//============================================================================ -Uuid::Uuid (const uint8_t buf[], unsigned length) { - - GuidFromHex(buf, length, this); -} - -//============================================================================ -bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid) { - - ASSERT(length == sizeof(uuid->data)); - memcpy(uuid->data, buf, sizeof(uuid->data)); - return true; -} diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h index 515d48cd..daae5008 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h @@ -80,9 +80,6 @@ bool GuidFromString (const char str[], Uuid * uuid); int GuidCompare (const Uuid & a, const Uuid & b); inline bool GuidsAreEqual (const Uuid & a, const Uuid & b) { return 0 == GuidCompare(a, b); } bool GuidIsNil (const Uuid & uuid); -const wchar_t * GuidToString (const Uuid & uuid, wchar_t * dst, unsigned chars); // returns dst -const char * GuidToString (const Uuid & uuid, char * dst, unsigned chars); // returns dst -bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid); /***************************************************************************** @@ -100,7 +97,6 @@ struct Uuid { Uuid () {} Uuid (const wchar_t str[]); - Uuid (const uint8_t buf[], unsigned length); operator bool () const { return !GuidIsNil(*this); } inline bool operator ! () const { return GuidIsNil(*this); } inline bool operator < (const Uuid & rhs) const { return GuidCompare(*this, rhs) < 0; } diff --git a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp index af55ba28..99728029 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp @@ -596,14 +596,17 @@ static void INetCliAuthAgeRequestCallback ( if (!IS_NET_ERROR(result) || result == kNetErrVaultNodeNotFound) { s_age.ageInstId = ageInstId; s_age.ageVaultId = ageVaultId; - - wchar_t ageInstIdStr[64]; + + plString gameAddrStr = gameAddr.GetHostString(); + plString ageInstIdStr = plUUID(ageInstId).AsString(); + LogMsg( kLogPerf, L"Connecting to game server %s, ageInstId %s", - gameAddr.GetHostString().ToWchar().GetData(), - GuidToString(ageInstId, ageInstIdStr, arrsize(ageInstIdStr)) + gameAddrStr.c_str(), + ageInstIdStr.c_str() ); + NetCliGameDisconnect(); NetCliGameStartConnect(gameAddr.GetHost()); NetCliGameJoinAgeRequest( diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp index 09988ec6..3596aa56 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp @@ -369,9 +369,9 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) { break; case kAgeInstGuid: { - Uuid guid = (Uuid)*info.GetAgeInstanceGuid(); + plUUID guid = (plUUID)*info.GetAgeInstanceGuid(); wchar_t src[64]; - GuidToString(guid, src, arrsize(src)); + wcsncpy(src, guid.AsString().ToWchar(), 64); unsigned len = StrLen(src); wchar_t * dst = buf.New(len); memcpy(dst, src, len * sizeof(src[0])); From a0641ba66be4d9f2f19b4164e9f3940948c1187d Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Fri, 28 Dec 2012 21:49:48 -0800 Subject: [PATCH 4/8] Clean up for Python interface stuff. --- .../Games/Marker/pyMarkerGameGlue.cpp | 2 +- .../FeatureLib/pfPython/Games/pyGameCli.cpp | 13 ++--- .../FeatureLib/pfPython/Games/pyGameCli.h | 6 +- .../pfPython/Games/pyGameCliGlue.cpp | 31 ++++------ .../pfPython/Games/pyGameMgrMsg.cpp | 25 ++++----- .../FeatureLib/pfPython/Games/pyGameMgrMsg.h | 13 +++-- .../pfPython/Games/pyGameMgrMsgGlue.cpp | 9 ++- Sources/Plasma/FeatureLib/pfPython/cyMisc.h | 2 + .../FeatureLib/pfPython/cyPythonInterface.cpp | 3 +- .../FeatureLib/pfPython/plPythonFileMod.cpp | 2 +- Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp | 2 +- .../pfPython/pyGUIControlDraggable.cpp | 1 + .../pfPython/pyGUIControlRadioGroup.cpp | 1 + .../FeatureLib/pfPython/pyGUIPopUpMenu.cpp | 1 + .../FeatureLib/pfPython/pyNotifyGlue.cpp | 6 +- .../pfPython/pyVaultAgeInfoNode.cpp | 9 ++- .../FeatureLib/pfPython/pyVaultAgeInfoNode.h | 4 +- .../pfPython/pyVaultAgeInfoNodeGlue.cpp | 3 +- .../FeatureLib/pfPython/pyVaultAgeLinkNode.h | 2 - .../FeatureLib/pfPython/pyVaultImageNode.cpp | 5 +- .../pfPython/pyVaultMarkerGameNode.cpp | 9 ++- .../pfPython/pyVaultMarkerGameNode.h | 4 +- .../pfPython/pyVaultMarkerGameNodeGlue.cpp | 3 +- .../FeatureLib/pfPython/pyVaultNode.cpp | 56 ++++++++----------- .../Plasma/FeatureLib/pfPython/pyVaultNode.h | 4 +- .../FeatureLib/pfPython/pyVaultNodeGlue.cpp | 3 +- .../pfPython/pyVaultPlayerInfoListNode.cpp | 2 +- .../pfPython/pyVaultPlayerInfoNode.cpp | 15 +++-- .../pfPython/pyVaultPlayerInfoNode.h | 5 +- .../pfPython/pyVaultPlayerInfoNodeGlue.cpp | 3 +- 30 files changed, 114 insertions(+), 130 deletions(-) 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) From bcf6e97d232bc33b36007dd8509f2ca8b1b8b2c4 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 29 Dec 2012 02:05:23 -0800 Subject: [PATCH 5/8] Replace Uuid with plUUID EVERYWHERE. --- .../Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp | 4 +- .../Plasma/FeatureLib/pfGameMgr/pfGameMgr.h | 4 +- .../Games/BlueSpiral/pyBlueSpiralGame.cpp | 6 +- .../Games/BlueSpiral/pyBlueSpiralGame.h | 2 +- .../Games/BlueSpiral/pyBlueSpiralGameGlue.cpp | 25 +-- .../Games/ClimbingWall/pyClimbingWallGame.cpp | 6 +- .../Games/ClimbingWall/pyClimbingWallGame.h | 2 +- .../ClimbingWall/pyClimbingWallGameGlue.cpp | 25 +-- .../pfPython/Games/Heek/pyHeekGame.cpp | 6 +- .../pfPython/Games/Heek/pyHeekGame.h | 2 +- .../pfPython/Games/Heek/pyHeekGameGlue.cpp | 25 +-- .../pfPython/Games/Marker/pyMarkerGame.cpp | 6 +- .../pfPython/Games/Marker/pyMarkerGame.h | 2 +- .../Games/Marker/pyMarkerGameGlue.cpp | 23 +-- .../pfPython/Games/TicTacToe/pyTTTGame.cpp | 6 +- .../pfPython/Games/TicTacToe/pyTTTGame.h | 2 +- .../Games/TicTacToe/pyTTTGameGlue.cpp | 25 +-- .../pfPython/Games/VarSync/pyVarSyncGame.cpp | 6 +- .../pfPython/Games/VarSync/pyVarSyncGame.h | 2 +- .../Games/VarSync/pyVarSyncGameGlue.cpp | 25 +-- .../FeatureLib/pfPython/Games/pyGameCli.cpp | 2 +- .../pfPython/Games/pyGameCliMsg.cpp | 3 +- .../pfPython/Games/pyGameMgrMsg.cpp | 4 +- Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp | 2 +- Sources/Plasma/FeatureLib/pfPython/cyMisc.h | 4 +- .../FeatureLib/pfPython/cyMiscGlue3.cpp | 9 +- .../Plasma/FeatureLib/pfPython/pyAgeVault.cpp | 2 +- .../FeatureLib/pfPython/pyDniInfoSource.cpp | 2 +- .../Plasma/FeatureLib/pfPython/pyVault.cpp | 8 +- .../pfPython/pyVaultAgeInfoNode.cpp | 2 +- .../pfPython/pyVaultMarkerGameNode.cpp | 5 +- .../FeatureLib/pfPython/pyVaultNode.cpp | 5 +- .../pfPython/pyVaultPlayerInfoNode.cpp | 7 +- .../FeatureLib/pfPython/pyVaultPlayerNode.cpp | 4 +- .../NucleusLib/pnAsyncCore/Private/pnAcIo.h | 11 +- .../NucleusLib/pnAsyncCoreExe/pnAceIo.cpp | 16 +- .../pnGameMgr/BlueSpiral/pnGmBlueSpiral.h | 2 +- .../pnGameMgr/ClimbingWall/pnGmClimbingWall.h | 2 +- .../NucleusLib/pnGameMgr/Heek/pnGmHeek.h | 2 +- .../NucleusLib/pnGameMgr/Marker/pnGmMarker.h | 2 +- Sources/Plasma/NucleusLib/pnGameMgr/Pch.h | 1 + .../pnGameMgr/TicTacToe/pnGmTicTacToe.h | 2 +- .../pnGameMgr/VarSync/pnGmVarSync.h | 2 +- .../Plasma/NucleusLib/pnGameMgr/pnGameMgr.h | 10 +- .../Plasma/NucleusLib/pnNetCli/pnNcCli.cpp | 4 +- .../NucleusLib/pnNetCommon/pnNetCommon.cpp | 22 ++- Sources/Plasma/NucleusLib/pnNetProtocol/Pch.h | 1 + .../Private/Protocols/Cli2Auth/pnNpCli2Auth.h | 30 ++-- .../Private/Protocols/Cli2Game/pnNpCli2Game.h | 6 +- .../Cli2GateKeeper/pnNpCli2GateKeeper.h | 2 +- .../Private/Protocols/Srv2Db/pnNpSrv2Db.h | 42 ++--- .../Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h | 30 ++-- .../Protocols/Srv2State/pnNpSrv2State.h | 6 +- .../Protocols/Srv2Vault/pnNpSrv2Vault.h | 60 +++---- .../pnNetProtocol/Private/pnNpCommon.cpp | 29 ++-- .../pnNetProtocol/Private/pnNpCommon.h | 44 ++--- Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp | 14 +- Sources/Plasma/NucleusLib/pnUUID/pnUUID.h | 7 +- .../Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp | 13 +- .../Plasma/NucleusLib/pnUtils/CMakeLists.txt | 4 - .../NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp | 69 -------- .../NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp | 150 ------------------ .../NucleusLib/pnUtils/pnUtAllIncludes.h | 1 - .../Plasma/NucleusLib/pnUtils/pnUtUuid.cpp | 66 -------- Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h | 110 ------------- .../plNetClient/plNetClientMsgHandler.cpp | 2 +- .../plNetClient/plNetLinkingMgr.cpp | 8 +- .../plNetClientComm/plNetClientComm.cpp | 22 +-- .../plNetClientComm/plNetClientComm.h | 14 +- .../plNetGameLib/Private/plNglAuth.cpp | 114 ++++++------- .../plNetGameLib/Private/plNglAuth.h | 24 +-- .../plNetGameLib/Private/plNglGame.cpp | 8 +- .../plNetGameLib/Private/plNglGame.h | 2 +- .../plNetGameLib/Private/plNglGateKeeper.cpp | 6 +- .../PubUtilLib/plVault/plVaultClientApi.cpp | 27 ++-- .../PubUtilLib/plVault/plVaultClientApi.h | 13 +- .../PubUtilLib/plVault/plVaultNodeAccess.cpp | 24 ++- .../PubUtilLib/plVault/plVaultNodeAccess.h | 32 ++-- 78 files changed, 427 insertions(+), 892 deletions(-) delete mode 100644 Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp delete mode 100644 Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp delete mode 100644 Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp delete mode 100644 Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp b/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp index a4a7bfb1..a612533a 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp @@ -409,7 +409,7 @@ void pfGameMgr::JoinGame ( //============================================================================ void pfGameMgr::CreateGame ( plKey receiver, - const Uuid & gameTypeId, + const plUUID& gameTypeId, unsigned createOptions, unsigned initBytes, const void * initData @@ -439,7 +439,7 @@ void pfGameMgr::CreateGame ( //============================================================================ void pfGameMgr::JoinCommonGame ( plKey receiver, - const Uuid & gameTypeId, + const plUUID& gameTypeId, unsigned gameNumber, unsigned initBytes, const void * initData diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.h b/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.h index 5f93ace7..d7a86cde 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.h +++ b/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.h @@ -170,7 +170,7 @@ public: // Create a new game void CreateGame ( plKey receiver, // Receiver of pfGameCliMsgs for this game - const Uuid & gameTypeId, // typeid of game to create + const plUUID& gameTypeId, // typeid of game to create unsigned createOptions, // Game create options from pnGameMgr.h unsigned initBytes, // Game-specific initialization data const void * initData @@ -178,7 +178,7 @@ public: // Join or create the specified common game void JoinCommonGame ( plKey receiver, // Receiver of pfGameCliMsgs for this game - const Uuid & gameTypeId, // typeid of common game to create/join + const plUUID& gameTypeId, // typeid of common game to create/join unsigned gameNumber, // "table number" of common game to create/join // In case the common game needs to // be created on the server, these diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.cpp index 3406c43a..b38a47f4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.cpp @@ -59,9 +59,9 @@ pyBlueSpiralGame::pyBlueSpiralGame(pfGameCli* client): pyGameCli(client) gameClient = nil; // wrong type, just clear it out } -bool pyBlueSpiralGame::IsBlueSpiralGame(std::wstring guid) +bool pyBlueSpiralGame::IsBlueSpiralGame(plString& guid) { - Uuid gameUuid(guid.c_str()); + plUUID gameUuid(guid); return gameUuid == kGameTypeId_BlueSpiral; } @@ -87,4 +87,4 @@ void pyBlueSpiralGame::HitCloth(int clothNum) pfGmBlueSpiral* blueSpiral = pfGmBlueSpiral::ConvertNoRef(gameClient); blueSpiral->HitCloth(clothNum); } -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.h b/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.h index 2a6fa7a4..7514337c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.h @@ -68,7 +68,7 @@ public: static void AddPlasmaClasses(PyObject* m); static void AddPlasmaMethods(std::vector& methods); - static bool IsBlueSpiralGame(std::wstring guid); + static bool IsBlueSpiralGame(plString& guid); static void JoinCommonBlueSpiralGame(pyKey& callbackKey, unsigned gameID); void StartGame(); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGameGlue.cpp index b08fd931..f2d8defb 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGameGlue.cpp @@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsBlueSpiralGame, args, "Params: typeID\nRetur PyObject* textObj; if (!PyArg_ParseTuple(args, "O", &textObj)) { - PyErr_SetString(PyExc_TypeError, "PtIsBlueSpiralGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsBlueSpiralGame expects a string"); PYTHON_RETURN_ERROR; } - if (PyUnicode_Check(textObj)) + + if (PyString_CheckEx(textObj)) { - int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = new wchar_t[strLen + 1]; - PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); - text[strLen] = L'\0'; + plString text = PyString_AsStringEx(textObj); + bool retVal = pyBlueSpiralGame::IsBlueSpiralGame(text); - delete [] text; - PYTHON_RETURN_BOOL(retVal); - } - else if (PyString_Check(textObj)) - { - // we'll allow this, just in case something goes weird - char* text = PyString_AsString(textObj); - wchar_t* wText = hsStringToWString(text); - bool retVal = pyBlueSpiralGame::IsBlueSpiralGame(wText); - delete [] wText; PYTHON_RETURN_BOOL(retVal); } else { - PyErr_SetString(PyExc_TypeError, "PtIsBlueSpiralGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsBlueSpiralGame expects a string"); PYTHON_RETURN_ERROR; } } @@ -159,4 +148,4 @@ void pyBlueSpiralGame::AddPlasmaMethods(std::vector& methods) { PYTHON_GLOBAL_METHOD(methods, PtIsBlueSpiralGame); PYTHON_GLOBAL_METHOD(methods, PtJoinCommonBlueSpiralGame); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.cpp index 87b4bdb1..a1a9e661 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.cpp @@ -59,9 +59,9 @@ pyClimbingWallGame::pyClimbingWallGame(pfGameCli* client): pyGameCli(client) gameClient = nil; // wrong type, just clear it out } -bool pyClimbingWallGame::IsClimbingWallGame(std::wstring guid) +bool pyClimbingWallGame::IsClimbingWallGame(plString& guid) { - Uuid gameUuid(guid.c_str()); + plUUID gameUuid(guid); return gameUuid == kGameTypeId_ClimbingWall; } @@ -132,4 +132,4 @@ void pyClimbingWallGame::Panic() pfGmClimbingWall* climbingWall = pfGmClimbingWall::ConvertNoRef(gameClient); climbingWall->Panic(); } -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.h b/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.h index 2552d7b3..b2817858 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.h @@ -69,7 +69,7 @@ public: static void AddPlasmaMethods(std::vector& methods); static void AddPlasmaConstantsClasses(PyObject* m); - static bool IsClimbingWallGame(std::wstring guid); + static bool IsClimbingWallGame(plString& guid); static void JoinCommonClimbingWallGame(pyKey& callbackKey, unsigned gameID); void ChangeNumBlockers(int amountToAdjust); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGameGlue.cpp index e67284e9..1738c4d4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGameGlue.cpp @@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsClimbingWallGame, args, "Params: typeID\nRet PyObject* textObj; if (!PyArg_ParseTuple(args, "O", &textObj)) { - PyErr_SetString(PyExc_TypeError, "PtIsClimbingWallGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsClimbingWallGame expects a string"); PYTHON_RETURN_ERROR; } - if (PyUnicode_Check(textObj)) + + if (PyString_CheckEx(textObj)) { - int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = new wchar_t[strLen + 1]; - PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); - text[strLen] = L'\0'; + plString text = PyString_AsStringEx(textObj); + bool retVal = pyClimbingWallGame::IsClimbingWallGame(text); - delete [] text; - PYTHON_RETURN_BOOL(retVal); - } - else if (PyString_Check(textObj)) - { - // we'll allow this, just in case something goes weird - char* text = PyString_AsString(textObj); - wchar_t* wText = hsStringToWString(text); - bool retVal = pyClimbingWallGame::IsClimbingWallGame(wText); - delete [] wText; PYTHON_RETURN_BOOL(retVal); } else { - PyErr_SetString(PyExc_TypeError, "PtIsClimbingWallGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsClimbingWallGame expects a string"); PYTHON_RETURN_ERROR; } } @@ -213,4 +202,4 @@ void pyClimbingWallGame::AddPlasmaConstantsClasses(PyObject* m) PYTHON_ENUM_ELEMENT(PtClimbingWallReadyTypes, kClimbingWallReadyNumBlockers, kClimbingWallReadyNumBlockers); PYTHON_ENUM_ELEMENT(PtClimbingWallReadyTypes, kClimbingWallReadyBlockers, kClimbingWallReadyBlockers); PYTHON_ENUM_END(m, PtClimbingWallReadyTypes); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.cpp index ec3071fe..8a684f24 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.cpp @@ -59,9 +59,9 @@ pyHeekGame::pyHeekGame(pfGameCli* client): pyGameCli(client) gameClient = nil; // wrong type, just clear it out } -bool pyHeekGame::IsHeekGame(std::wstring guid) +bool pyHeekGame::IsHeekGame(plString& guid) { - Uuid gameUuid(guid.c_str()); + plUUID gameUuid(guid); return gameUuid == kGameTypeId_Heek; } @@ -104,4 +104,4 @@ void pyHeekGame::SequenceFinished(int seq) pfGmHeek* heek = pfGmHeek::ConvertNoRef(gameClient); heek->SequenceFinished((EHeekSeqFinished)seq); } -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.h b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.h index 8db63168..13787e1c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.h @@ -69,7 +69,7 @@ public: static void AddPlasmaConstantsClasses(PyObject* m); static void AddPlasmaMethods(std::vector& methods); - static bool IsHeekGame(std::wstring guid); + static bool IsHeekGame(plString& guid); static void JoinCommonHeekGame(pyKey& callbackKey, unsigned gameID); void PlayGame(int position, uint32_t points, std::wstring name); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGameGlue.cpp index 604c18f9..f24d4db4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGameGlue.cpp @@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsHeekGame, args, "Params: typeID\nReturns tru PyObject* textObj; if (!PyArg_ParseTuple(args, "O", &textObj)) { - PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a string"); PYTHON_RETURN_ERROR; } - if (PyUnicode_Check(textObj)) + + if (PyString_CheckEx(textObj)) { - int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = new wchar_t[strLen + 1]; - PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); - text[strLen] = L'\0'; + plString text = PyString_AsStringEx(textObj); + bool retVal = pyHeekGame::IsHeekGame(text); - delete [] text; - PYTHON_RETURN_BOOL(retVal); - } - else if (PyString_Check(textObj)) - { - // we'll allow this, just in case something goes weird - char* text = PyString_AsString(textObj); - wchar_t* wText = hsStringToWString(text); - bool retVal = pyHeekGame::IsHeekGame(wText); - delete [] wText; PYTHON_RETURN_BOOL(retVal); } else { - PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a string"); PYTHON_RETURN_ERROR; } } @@ -224,4 +213,4 @@ void pyHeekGame::AddPlasmaMethods(std::vector& methods) { PYTHON_GLOBAL_METHOD(methods, PtIsHeekGame); PYTHON_GLOBAL_METHOD(methods, PtJoinCommonHeekGame); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.cpp index f715fd47..fb2917ca 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.cpp @@ -60,9 +60,9 @@ pyMarkerGame::pyMarkerGame(pfGameCli* client): pyGameCli(client) gameClient = nil; // wrong type, just clear it out } -bool pyMarkerGame::IsMarkerGame(std::wstring guid) +bool pyMarkerGame::IsMarkerGame(plString& guid) { - Uuid gameUuid(guid.c_str()); + plUUID gameUuid(guid); return gameUuid == kGameTypeId_Marker; } @@ -164,4 +164,4 @@ void pyMarkerGame::CaptureMarker(unsigned long markerId) pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient); marker->CaptureMarker(markerId); } -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.h b/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.h index f86173f5..ac296b43 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.h @@ -69,7 +69,7 @@ public: static void AddPlasmaConstantsClasses(PyObject* m); static void AddPlasmaMethods(std::vector& methods); - static bool IsMarkerGame(std::wstring guid); + static bool IsMarkerGame(plString& guid); static void CreateMarkerGame(pyKey& callbackKey, unsigned gameType, std::wstring gameName, unsigned long timeLimit, std::wstring templateId); void StartGame(); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp index eb49b96b..101fb007 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp @@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsMarkerGame, args, "Params: typeID\nReturns t PyObject* textObj; if (!PyArg_ParseTuple(args, "O", &textObj)) { - PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a string"); PYTHON_RETURN_ERROR; } - if (PyUnicode_Check(textObj)) + + if (PyString_CheckEx(textObj)) { - int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = new wchar_t[strLen + 1]; - PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); - text[strLen] = L'\0'; + plString text = PyString_AsStringEx(textObj); + bool retVal = pyMarkerGame::IsMarkerGame(text); - delete [] text; - PYTHON_RETURN_BOOL(retVal); - } - else if (PyString_Check(textObj)) - { - // we'll allow this, just in case something goes weird - char* text = PyString_AsString(textObj); - wchar_t* wText = hsStringToWString(text); - bool retVal = pyMarkerGame::IsMarkerGame(wText); - delete [] wText; PYTHON_RETURN_BOOL(retVal); } else { - PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a string"); PYTHON_RETURN_ERROR; } } diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.cpp index 97f290e2..43d43834 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.cpp @@ -59,9 +59,9 @@ pyTTTGame::pyTTTGame(pfGameCli* client): pyGameCli(client) gameClient = nil; // wrong type, just clear it out } -bool pyTTTGame::IsTTTGame(std::wstring guid) +bool pyTTTGame::IsTTTGame(plString& guid) { - Uuid gameUuid(guid.c_str()); + plUUID gameUuid(guid); return gameUuid == kGameTypeId_TicTacToe; } @@ -95,4 +95,4 @@ void pyTTTGame::ShowBoard() pfGmTicTacToe* ttt = pfGmTicTacToe::ConvertNoRef(gameClient); ttt->ShowBoard(); } -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.h b/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.h index 740859b0..d2f03fc3 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.h @@ -69,7 +69,7 @@ public: static void AddPlasmaConstantsClasses(PyObject* m); static void AddPlasmaMethods(std::vector& methods); - static bool IsTTTGame(std::wstring guid); + static bool IsTTTGame(plString& guid); static void CreateTTTGame(pyKey& callbackKey, unsigned numPlayers); static void JoinCommonTTTGame(pyKey& callbackKey, unsigned gameID, unsigned numPlayers); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGameGlue.cpp index 4be01e71..039a8d68 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGameGlue.cpp @@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsTTTGame, args, "Params: typeID\nReturns true PyObject* textObj; if (!PyArg_ParseTuple(args, "O", &textObj)) { - PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a string"); PYTHON_RETURN_ERROR; } - if (PyUnicode_Check(textObj)) + + if (PyString_CheckEx(textObj)) { - int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = new wchar_t[strLen + 1]; - PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); - text[strLen] = L'\0'; + plString text = PyString_AsStringEx(textObj); + bool retVal = pyTTTGame::IsTTTGame(text); - delete [] text; - PYTHON_RETURN_BOOL(retVal); - } - else if (PyString_Check(textObj)) - { - // we'll allow this, just in case something goes weird - char* text = PyString_AsString(textObj); - wchar_t* wText = hsStringToWString(text); - bool retVal = pyTTTGame::IsTTTGame(wText); - delete [] wText; PYTHON_RETURN_BOOL(retVal); } else { - PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a string"); PYTHON_RETURN_ERROR; } } @@ -189,4 +178,4 @@ void pyTTTGame::AddPlasmaMethods(std::vector& methods) PYTHON_GLOBAL_METHOD(methods, PtIsTTTGame); PYTHON_GLOBAL_METHOD(methods, PtCreateTTTGame); PYTHON_GLOBAL_METHOD(methods, PtJoinCommonTTTGame); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.cpp index 8728bf58..bf759687 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.cpp @@ -61,9 +61,9 @@ pyVarSyncGame::pyVarSyncGame(pfGameCli* client): pyGameCli(client) gameClient = nil; // wrong type, just clear it out } -bool pyVarSyncGame::IsVarSyncGame(std::wstring guid) +bool pyVarSyncGame::IsVarSyncGame(plString& guid) { - Uuid gameUuid(guid.c_str()); + plUUID gameUuid(guid); return gameUuid == kGameTypeId_VarSync; } @@ -117,4 +117,4 @@ void pyVarSyncGame::CreateNumericVar(std::wstring name, double val) pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient); vsync->CreateNumericVar(name.c_str(), val); } -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.h b/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.h index b83e543c..49e5cbf3 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.h @@ -68,7 +68,7 @@ public: static void AddPlasmaClasses(PyObject* m); static void AddPlasmaMethods(std::vector& methods); - static bool IsVarSyncGame(std::wstring guid); + static bool IsVarSyncGame(plString& guid); static void JoinCommonVarSyncGame(pyKey& callbackKey); void SetStringVar(unsigned long id, std::wstring val); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGameGlue.cpp index 5434e55a..3500707b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGameGlue.cpp @@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsVarSyncGame, args, "Params: typeID\nReturns PyObject* textObj; if (!PyArg_ParseTuple(args, "O", &textObj)) { - PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a string"); PYTHON_RETURN_ERROR; } - if (PyUnicode_Check(textObj)) + + if (PyString_CheckEx(textObj)) { - int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = new wchar_t[strLen + 1]; - PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); - text[strLen] = L'\0'; + plString text = PyString_AsStringEx(textObj); + bool retVal = pyVarSyncGame::IsVarSyncGame(text); - delete [] text; - PYTHON_RETURN_BOOL(retVal); - } - else if (PyString_Check(textObj)) - { - // we'll allow this, just in case something goes weird - char* text = PyString_AsString(textObj); - wchar_t* wText = hsStringToWString(text); - bool retVal = pyVarSyncGame::IsVarSyncGame(wText); - delete [] wText; PYTHON_RETURN_BOOL(retVal); } else { - PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a unicode string"); + PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a string"); PYTHON_RETURN_ERROR; } } @@ -325,4 +314,4 @@ void pyVarSyncGame::AddPlasmaMethods(std::vector& methods) { PYTHON_GLOBAL_METHOD(methods, PtIsVarSyncGame); PYTHON_GLOBAL_METHOD(methods, PtJoinCommonVarSyncGame); -} \ 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 b1153236..a1d9533d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp @@ -106,7 +106,7 @@ plUUID pyGameCli::GameTypeID() const { return plUUID(gameClient->GetGameTypeId()); } - return plUUID(); + return kNilUuid; } std::wstring pyGameCli::Name() const diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliMsg.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliMsg.cpp index 53c0f2aa..1a949e61 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliMsg.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliMsg.cpp @@ -129,7 +129,8 @@ PyObject* pyGameCliMsg::UpcastToGameMsg() const if (!message) PYTHON_RETURN_NONE; - const Uuid& gameTypeId = message->gameCli->GetGameTypeId(); + const plUUID& gameTypeId = message->gameCli->GetGameTypeId(); + if (gameTypeId == kGameTypeId_TicTacToe) return pyTTTMsg::New(message); else if (gameTypeId == kGameTypeId_Heek) diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp index f4002871..07f91329 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp @@ -111,7 +111,7 @@ plUUID pyGameMgrInviteReceivedMsg::GameTypeID() const const Srv2Cli_GameMgr_InviteReceived* gmMsg = (const Srv2Cli_GameMgr_InviteReceived*)message->netMsg; return plUUID(gmMsg->gameTypeId); } - return plUUID(); + return kNilUuid; } uint32_t pyGameMgrInviteReceivedMsg::NewGameID() const @@ -150,7 +150,7 @@ plUUID pyGameMgrInviteRevokedMsg::GameTypeID() const const Srv2Cli_GameMgr_InviteRevoked* gmMsg = (const Srv2Cli_GameMgr_InviteRevoked*)message->netMsg; return plUUID(gmMsg->gameTypeId); } - return plUUID(); + return kNilUuid; } uint32_t pyGameMgrInviteRevokedMsg::NewGameID() const diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp index c7eb6341..b3a90bc3 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp @@ -1689,7 +1689,7 @@ void cyMisc::SetShareSpawnPoint(const char* spawnPoint) pMsg->Send(); } -void cyMisc::SetShareAgeInstanceGuid(const Uuid& guid) +void cyMisc::SetShareAgeInstanceGuid(const plUUID& guid) { plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kSetShareAgeInstanceGuid); plKey k = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h index 0293e2d4..a0d901f8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h @@ -66,8 +66,8 @@ class pyPoint3; class pyGUIDialog; class plPipeline; class plDisplayMode; +class plUUID; struct PipelineParams; -struct Uuid; typedef struct _object PyObject; typedef struct PyMethodDef PyMethodDef; @@ -636,7 +636,7 @@ public: static void NotifyOffererPublicLinkCompleted(uint32_t offerer); static void ToggleAvatarClickability(bool on); static void SetShareSpawnPoint(const char* spawnPoint); - static void SetShareAgeInstanceGuid(const Uuid& guid); + static void SetShareAgeInstanceGuid(const plUUID& guid); ////////////////////////////////////////////////////////////////////////////// // diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp index 689302b0..e763aef8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp @@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyGlueHelpers.h" #include "pySceneObject.h" #include "pnUtils/pnUtils.h" +#include "pnUUID/pnUUID.h" PYTHON_GLOBAL_METHOD_DEFINITION(PtSendPetitionToCCR, args, "Params: message,reason=0,title=\"\"\nSends a petition with a message to the CCR group") { @@ -437,12 +438,14 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtSetShareAgeInstanceGuid, args, "Params: instan PyErr_SetString(PyExc_TypeError, "PtSetShareAgeInstanceGuid expects a string"); PYTHON_RETURN_ERROR; } - Uuid guid; - if (!GuidFromString(guidStr, &guid)) + + plUUID guid(guidStr); + if (guid == kNilUuid) { PyErr_SetString(PyExc_TypeError, "PtSetShareAgeInstanceGuid string parameter is not a guid string"); PYTHON_RETURN_ERROR; } + cyMisc::SetShareAgeInstanceGuid(guid); PYTHON_RETURN_NONE; } @@ -778,4 +781,4 @@ void cyMisc::AddPlasmaMethods3(std::vector &methods) PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetUserPath); PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetInitPath); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp index 1a2a5e4f..16e2c093 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp @@ -193,7 +193,7 @@ plUUID pyAgeVault::GetAgeGuid( void ) rvn->DecRef(); return uuid; } - return plUUID(); + return kNilUuid; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp b/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp index 42f3ee87..702d10d2 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp @@ -111,5 +111,5 @@ plUUID pyDniInfoSource::GetAgeGuid( void ) const return uuid; } - return plUUID(); + return kNilUuid; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp index 73a38b6d..cbecd840 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp @@ -531,7 +531,7 @@ bool pyVault::AmAgeOwner( const pyAgeInfoStruct * ageInfo ) if (!ageInfo->GetAgeInfo()) return false; - Uuid ageInstId = *ageInfo->GetAgeInfo()->GetAgeInstanceGuid(); + plUUID ageInstId = *ageInfo->GetAgeInfo()->GetAgeInstanceGuid(); return VaultAmOwnerOfAge(ageInstId); } @@ -540,7 +540,7 @@ bool pyVault::AmAgeCzar( const pyAgeInfoStruct * ageInfo ) if (!ageInfo->GetAgeInfo()) return false; - Uuid ageInstId = *ageInfo->GetAgeInfo()->GetAgeInstanceGuid(); + plUUID ageInstId = *ageInfo->GetAgeInfo()->GetAgeInstanceGuid(); return VaultAmCzarOfAge(ageInstId); } @@ -574,10 +574,8 @@ void pyVault::RegisterVisitAge( const pyAgeLinkStruct & link ) void pyVault::UnRegisterVisitAge( const char * guidstr ) { - Uuid uuid; - GuidFromString(guidstr, &uuid); plAgeInfoStruct info; - plUUID guid(uuid); + plUUID guid(guidstr); info.SetAgeInstanceGuid(&guid); VaultUnregisterVisitAgeAndWait(&info); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp index 5e911472..5a914ab8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp @@ -236,7 +236,7 @@ plUUID pyVaultAgeInfoNode::GetAgeInstanceGuid() const return plUUID(access.ageInstUuid); } - return plUUID(); + return kNilUuid; } void pyVaultAgeInfoNode::SetAgeInstanceGuid( const char * sguid ) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp index 965bb559..2901d681 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp @@ -95,15 +95,14 @@ plUUID pyVaultMarkerGameNode::GetGameGuid() const VaultMarkerGameNode access(fNode); return plUUID(access.gameGuid); } - return plUUID(); + return kNilUuid; } void pyVaultMarkerGameNode::SetGameGuid (const char v[]) { if (fNode) { VaultMarkerGameNode access(fNode); - Uuid uuid; - GuidFromString(v, &uuid); + plUUID uuid(v); access.SetGameGuid(uuid); } } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp index 710af162..baeee32e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp @@ -328,7 +328,7 @@ plUUID pyVaultNode::GetCreateAgeGuid(void) const return plUUID(fNode->createAgeUuid); } - return plUUID(); + return kNilUuid; } PyObject* pyVaultNode::GetCreateAgeCoords () { @@ -384,8 +384,7 @@ void pyVaultNode::SetCreateAgeName( const char * v ) void pyVaultNode::SetCreateAgeGuid( const char * v ) { ASSERT(fNode); - Uuid uuid; - GuidFromString(v, &uuid); + plUUID uuid(v); fNode->SetCreateAgeUuid(uuid); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp index 8c15ffd8..15547e56 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp @@ -153,10 +153,9 @@ void pyVaultPlayerInfoNode::Player_SetAgeGuid( const char * guidtext) if (!fNode) return; - Uuid ageInstId; - GuidFromString(guidtext, &ageInstId); + plUUID ageInstId(guidtext); VaultPlayerInfoNode playerInfo(fNode); - playerInfo.SetAgeInstUuid(ageInstId); + playerInfo.SetAgeInstUuid(ageInstId); } plUUID pyVaultPlayerInfoNode::Player_GetAgeGuid(void) const @@ -165,7 +164,7 @@ plUUID pyVaultPlayerInfoNode::Player_GetAgeGuid(void) const VaultPlayerInfoNode playerInfo(fNode); return plUUID(playerInfo.ageInstUuid); } - return plUUID(); + return kNilUuid; } // online status diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp index 3cae6818..3abc2d01 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp @@ -236,10 +236,8 @@ PyObject *pyVaultPlayerNode::GetVisitAgeLink(const pyAgeInfoStruct *info) void pyVaultPlayerNode::RemoveVisitAgeLink(const char *guidstr) { - Uuid uuid; - GuidFromString(guidstr, &uuid); plAgeInfoStruct info; - plUUID guid(uuid); + plUUID guid(guidstr); info.SetAgeInstanceGuid(&guid); VaultUnregisterOwnedAgeAndWait(&info); } diff --git a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h index b2dae81d..73605e3b 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h +++ b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h @@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNASYNCCORE_PRIVATE_PNACIO_H #include "pnNetCommon/plNetAddress.h" +#include "pnUUID/pnUUID.h" /**************************************************************************** @@ -79,7 +80,7 @@ struct AsyncSocketConnectPacket { uint32_t buildId; uint32_t buildType; uint32_t branchId; - Uuid productId; + plUUID productId; }; #pragma pack(pop) @@ -114,7 +115,7 @@ struct AsyncNotifySocketListen : AsyncNotifySocketConnect { unsigned buildId; unsigned buildType; unsigned branchId; - Uuid productId; + plUUID productId; plNetAddress addr; uint8_t * buffer; unsigned bytes; @@ -183,7 +184,7 @@ void AsyncSocketRegisterNotifyProc ( unsigned buildId = 0, unsigned buildType = 0, unsigned branchId = 0, - const Uuid & productId = kNilGuid + const plUUID& productId = kNilUuid ); void AsyncSocketUnregisterNotifyProc ( @@ -192,7 +193,7 @@ void AsyncSocketUnregisterNotifyProc ( unsigned buildId = 0, unsigned buildType = 0, unsigned branchId = 0, - const Uuid & productId = kNilGuid + const plUUID& productId = kNilUuid ); FAsyncNotifySocketProc AsyncSocketFindNotifyProc ( @@ -203,7 +204,7 @@ FAsyncNotifySocketProc AsyncSocketFindNotifyProc ( unsigned * buildId, unsigned * buildType, unsigned * branchId, - Uuid * productId + plUUID* productId ); diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp index a0bf3ecf..eb94d2a9 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp @@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // uint32_t buildId; [optional] // uint32_t branchId; [optional] // uint32_t buildType; [optional] -// Uuid productId; [optional] +// plUUID productId; [optional] const unsigned kConnHashFlagsIgnore = 0x01; const unsigned kConnHashFlagsExactMatch = 0x02; struct ISocketConnHash { @@ -70,7 +70,7 @@ struct ISocketConnHash { unsigned buildId; unsigned buildType; unsigned branchId; - Uuid productId; + plUUID productId; unsigned flags; unsigned GetHash () const; @@ -102,7 +102,7 @@ unsigned ISocketConnHash::GetHash () const { hash.Hash32(buildType); if (branchId) hash.Hash32(branchId); - if (productId != kNilGuid) + if (productId != kNilUuid) hash.Hash(&productId, sizeof(productId)); */ return hash.GetHash(); @@ -145,7 +145,7 @@ bool ISocketConnHash::operator== (const ISocketConnHash & rhs) const { if (productId != rhs.productId) { if (rhs.flags & kConnHashFlagsExactMatch) break; - if (productId != kNilGuid) + if (productId != kNilUuid) break; } @@ -171,7 +171,7 @@ static unsigned GetConnHash ( hash->buildId = 0; hash->buildType = 0; hash->branchId = 0; - hash->productId = 0; + hash->productId = kNilUuid; hash->flags = 0; // one uint8_t consumed @@ -325,7 +325,7 @@ void AsyncSocketRegisterNotifyProc ( unsigned buildId, unsigned buildType, unsigned branchId, - const Uuid & productId + const plUUID& productId ) { ASSERT(connType != kConnTypeNil); ASSERT(notifyProc); @@ -354,7 +354,7 @@ void AsyncSocketUnregisterNotifyProc ( unsigned buildId, unsigned buildType, unsigned branchId, - const Uuid & productId + const plUUID& productId ) { ISocketConnHash hash; hash.connType = connType; @@ -392,7 +392,7 @@ FAsyncNotifySocketProc AsyncSocketFindNotifyProc ( unsigned * buildId, unsigned * buildType, unsigned * branchId, - Uuid * productId + plUUID* productId ) { for (;;) { // Get the connType diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/BlueSpiral/pnGmBlueSpiral.h b/Sources/Plasma/NucleusLib/pnGameMgr/BlueSpiral/pnGmBlueSpiral.h index 3210c765..fd8754fd 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/BlueSpiral/pnGmBlueSpiral.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/BlueSpiral/pnGmBlueSpiral.h @@ -68,7 +68,7 @@ enum EBlueSpiralInitResult { // Game type id //============================================================================ -const Uuid kGameTypeId_BlueSpiral = Uuid(L"5ff98165-913e-4fd1-a2c2-9c7f31be2cc8"); +const plUUID kGameTypeId_BlueSpiral("5ff98165-913e-4fd1-a2c2-9c7f31be2cc8"); //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/ClimbingWall/pnGmClimbingWall.h b/Sources/Plasma/NucleusLib/pnGameMgr/ClimbingWall/pnGmClimbingWall.h index 9afccb28..0e89dc1b 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/ClimbingWall/pnGmClimbingWall.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/ClimbingWall/pnGmClimbingWall.h @@ -75,7 +75,7 @@ const int kClimbingWallNoBlocker = -1; // the value of a slot in the blocker arr // Game type id //============================================================================ -const Uuid kGameTypeId_ClimbingWall = Uuid(L"6224cdf4-3556-4740-b7cd-d637562d07be"); +const plUUID kGameTypeId_ClimbingWall("6224cdf4-3556-4740-b7cd-d637562d07be"); //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/Heek/pnGmHeek.h b/Sources/Plasma/NucleusLib/pnGameMgr/Heek/pnGmHeek.h index 6511680e..fdaa8ba7 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/Heek/pnGmHeek.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/Heek/pnGmHeek.h @@ -91,7 +91,7 @@ enum EHeekCountdownState { // Game type id //============================================================================ -const Uuid kGameTypeId_Heek = Uuid(L"9d83c2e2-7835-4477-9aaa-22254c59a753"); +const plUUID kGameTypeId_Heek("9d83c2e2-7835-4477-9aaa-22254c59a753"); //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/Marker/pnGmMarker.h b/Sources/Plasma/NucleusLib/pnGameMgr/Marker/pnGmMarker.h index a90f39ae..419a4035 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/Marker/pnGmMarker.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/Marker/pnGmMarker.h @@ -75,7 +75,7 @@ enum EMarkerGameType { // Game type id //============================================================================ -const Uuid kGameTypeId_Marker = Uuid(L"000b2c39-0319-4be1-b06c-7a105b160fcf"); +const plUUID kGameTypeId_Marker("000b2c39-0319-4be1-b06c-7a105b160fcf"); //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/Pch.h b/Sources/Plasma/NucleusLib/pnGameMgr/Pch.h index 78a46e76..b9049068 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/Pch.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/Pch.h @@ -54,6 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnUtils/pnUtils.h" #include "pnNetBase/pnNetBase.h" #include "pnProduct/pnProduct.h" +#include "pnUUID/pnUUID.h" #include "pnGameMgr.h" #include "Intern.h" diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/TicTacToe/pnGmTicTacToe.h b/Sources/Plasma/NucleusLib/pnGameMgr/TicTacToe/pnGmTicTacToe.h index 68e85305..4b261363 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/TicTacToe/pnGmTicTacToe.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/TicTacToe/pnGmTicTacToe.h @@ -74,7 +74,7 @@ enum ETTTGameResult { // Game type id //============================================================================ -const Uuid kGameTypeId_TicTacToe = Uuid(L"a7236529-11d8-4758-9368-59cb43445a83"); +const plUUID kGameTypeId_TicTacToe("a7236529-11d8-4758-9368-59cb43445a83"); //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/VarSync/pnGmVarSync.h b/Sources/Plasma/NucleusLib/pnGameMgr/VarSync/pnGmVarSync.h index 892a62d7..4aea2833 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/VarSync/pnGmVarSync.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/VarSync/pnGmVarSync.h @@ -68,7 +68,7 @@ enum EVarSyncInitResult { // Game type id //============================================================================ -const Uuid kGameTypeId_VarSync = Uuid(L"475c2e9b-a245-4106-a047-9b25d41ff333"); +const plUUID kGameTypeId_VarSync("475c2e9b-a245-4106-a047-9b25d41ff333"); //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/pnGameMgr.h b/Sources/Plasma/NucleusLib/pnGameMgr/pnGameMgr.h index 3aa9bd66..e81c8580 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/pnGameMgr.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/pnGameMgr.h @@ -181,7 +181,7 @@ enum { // Cli2Srv struct Cli2Srv_GameMgr_CreateGame : GameMsgHeader { - Uuid gameTypeId; + plUUID gameTypeId; uint32_t createOptions; uint32_t createDataBytes; uint8_t createData[1]; // [createDataBytes] @@ -190,7 +190,7 @@ enum { // Field ordering here is vitally important, see pfGameMgr::JoinGame for explanation uint32_t newGameId; uint32_t createOptions; - Uuid gameTypeId; + plUUID gameTypeId; uint32_t createDataBytes; uint8_t createData[1]; // [createDataBytes] }; @@ -199,17 +199,17 @@ enum { struct Srv2Cli_GameMgr_GameInstance : GameMsgHeader { EGameJoinError result; uint32_t ownerId; - Uuid gameTypeId; + plUUID gameTypeId; uint32_t newGameId; }; struct Srv2Cli_GameMgr_InviteReceived : GameMsgHeader { uint32_t inviterId; - Uuid gameTypeId; + plUUID gameTypeId; uint32_t newGameId; }; struct Srv2Cli_GameMgr_InviteRevoked : GameMsgHeader { uint32_t inviterId; - Uuid gameTypeId; + plUUID gameTypeId; uint32_t newGameId; }; diff --git a/Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp b/Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp index a50f308c..ee941c87 100644 --- a/Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp @@ -49,6 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #pragma hdrstop #include "pnEncryption/plChallengeHash.h" +#include "pnUUID/pnUUID.h" //#define NCCLI_DEBUGGING #ifdef NCCLI_DEBUGGING @@ -112,7 +113,7 @@ enum ENetCliMode { ***/ // connection structure attached to each socket -struct NetCli : THashKeyVal { +struct NetCli { // communication channel AsyncSocket sock; @@ -917,7 +918,6 @@ static NetCli * ConnCreate ( cli->protocol = (ENetProtocol) protocol; cli->channel = channel; cli->mode = mode; - cli->SetValue(kNilGuid); #if !defined(PLASMA_EXTERNAL_RELEASE) && defined(HS_BUILD_FOR_WIN32) // Network debug pipe diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.cpp index 3554ebfb..8c34e98a 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.cpp @@ -105,25 +105,31 @@ uint32_t GetBinAddr(const char * textAddr) void plCreatableStream::Write( hsStream* stream, hsResMgr* mgr ) { fStream.Rewind(); - std::string buf; + uint32_t len = fStream.GetEOF(); stream->WriteLE( len ); - buf.resize( len ); - fStream.Read( len, (void*)buf.data() ); - stream->Write( len, (const void*)buf.data() ); + + uint8_t* buf = new uint8_t[len]; + fStream.Read(len, (void*)buf); + stream->Write(len, (const void*)buf); + fStream.Rewind(); + delete[] buf; } void plCreatableStream::Read( hsStream* stream, hsResMgr* mgr ) { fStream.Rewind(); - std::string buf; + uint32_t len; stream->LogReadLE( &len,"CreatableStream Len"); - buf.resize( len ); - stream->LogRead( len, (void*)buf.data(),"CreatableStream Data"); - fStream.Write( len, (const void*)buf.data() ); + + uint8_t* buf = new uint8_t[len]; + stream->LogRead(len, (void*)buf, "CreatableStream Data"); + fStream.Write(len, (const void*)buf); + fStream.Rewind(); + delete[] buf; } //////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Pch.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Pch.h index 7799fb55..62e7d06f 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Pch.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Pch.h @@ -55,6 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnNetBase/pnNetBase.h" #include "pnAsyncCore/pnAsyncCore.h" #include "pnNetCli/pnNetCli.h" +#include "pnUUID/pnUUID.h" #ifdef SERVER #include "psUtils/psUtils.h" // for SrvMsgHeader, ugh diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.h index f7fc7024..776ac59f 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.h @@ -229,7 +229,7 @@ static_assert(kNumAuth2CliMessages <= 0xFFFF, "Auth2Cli message types overflow u struct Cli2Auth_ConnData { uint32_t dataBytes; - Uuid token; + plUUID token; }; struct Cli2Auth_Connect { AsyncSocketConnectPacket hdr; @@ -286,7 +286,7 @@ struct Cli2Auth_AgeRequest { uint32_t messageId; uint32_t transId; wchar_t ageName[kMaxAgeNameLength]; - Uuid ageUuid; + plUUID ageUuid; }; // AcctCreateRequest @@ -307,7 +307,7 @@ struct Cli2Auth_AcctCreateFromKeyRequest { uint32_t transId; wchar_t accountName[kMaxAccountNameLength]; ShaDigest namePassHash; - Uuid key; + plUUID key; uint32_t billingType; }; @@ -375,7 +375,7 @@ extern const NetMsg kNetMsg_Cli2Auth_AcctActivateRequest; struct Cli2Auth_AcctActivateRequest { uint32_t messageId; uint32_t transId; - Uuid activationKey; + plUUID activationKey; }; // FileListRequest @@ -435,7 +435,7 @@ struct Cli2Auth_VaultNodeSave { uint32_t messageId; uint32_t transId; uint32_t nodeId; - Uuid revisionId; + plUUID revisionId; uint32_t nodeBytes; uint8_t nodeBuffer[1]; }; @@ -462,8 +462,8 @@ extern const NetMsg kNetMsg_Cli2Auth_VaultInitAgeRequest; struct Cli2Auth_VaultInitAgeRequest { uint32_t messageId; uint32_t transId; - Uuid ageInstId; - Uuid parentAgeInstId; + plUUID ageInstId; + plUUID parentAgeInstId; wchar_t ageFilename[MAX_PATH]; wchar_t ageInstName[MAX_PATH]; wchar_t ageUserName[MAX_PATH]; @@ -572,7 +572,7 @@ extern const NetMsg kNetMsg_Cli2Auth_SendFriendInviteRequest; struct Cli2Auth_SendFriendInviteRequest { uint32_t messageId; uint32_t transId; - Uuid inviteUuid; + plUUID inviteUuid; wchar_t emailAddress[kMaxEmailAddressLength]; wchar_t toName[kMaxPlayerNameLength]; }; @@ -679,7 +679,7 @@ extern const NetMsg kNetMsg_Auth2Cli_ServerAddr; struct Auth2Cli_ServerAddr { uint32_t messageId; uint32_t srvAddr; - Uuid token; + plUUID token; }; extern const NetMsg kNetMsg_Auth2Cli_NotifyNewBuild; @@ -704,7 +704,7 @@ struct Auth2Cli_AcctLoginReply { uint32_t messageId; uint32_t transId; ENetError result; - Uuid accountId; + plUUID accountId; uint32_t accountFlags; uint32_t billingType; uint32_t encryptionKey[4]; @@ -717,7 +717,7 @@ struct Auth2Cli_AgeReply { uint32_t transId; ENetError result; uint32_t ageMcpId; - Uuid ageInstId; + plUUID ageInstId; uint32_t ageVaultId; uint32_t gameSrvNode; }; @@ -728,7 +728,7 @@ struct Auth2Cli_AcctCreateReply { uint32_t messageId; uint32_t transId; ENetError result; - Uuid accountId; + plUUID accountId; }; // AcctCreateFromKeyReply @@ -737,8 +737,8 @@ struct Auth2Cli_AcctCreateFromKeyReply { uint32_t messageId; uint32_t transId; ENetError result; - Uuid accountId; - Uuid activationKey; + plUUID accountId; + plUUID activationKey; }; // CreatePlayerReply @@ -870,7 +870,7 @@ extern const NetMsg kNetMsg_Auth2Cli_VaultNodeChanged; struct Auth2Cli_VaultNodeChanged { uint32_t messageId; uint32_t nodeId; - Uuid revisionId; + plUUID revisionId; }; extern const NetMsg kNetMsg_Auth2Cli_VaultNodeAdded; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h index ac06b83c..b04c2a7e 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h @@ -97,8 +97,8 @@ static_assert(kNumGame2CliMessages <= 0xFFFF, "Game2Cli message types overflow u struct Cli2Game_ConnData { uint32_t dataBytes; - Uuid accountUuid; - Uuid ageUuid; + plUUID accountUuid; + plUUID ageUuid; }; struct Cli2Game_Connect { AsyncSocketConnectPacket hdr; @@ -125,7 +125,7 @@ struct Cli2Game_JoinAgeRequest { uint32_t messageId; uint32_t transId; uint32_t ageMcpId; - Uuid accountUuid; + plUUID accountUuid; uint32_t playerInt; }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h index 42810676..f2e1f425 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h @@ -89,7 +89,7 @@ static_assert(kNumGateKeeper2CliMessages <= 0xFFFF, "GateKeeper2Cli message type struct Cli2GateKeeper_ConnData { uint32_t dataBytes; - Uuid token; + plUUID token; }; struct Cli2GateKeeper_Connect { diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.h index 3bd0a089..b1cb2c50 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.h @@ -201,7 +201,7 @@ struct Srv2Db_AccountCreateRequest : SrvMsgHeader { struct Srv2Db_AccountCreateFromKeyRequest : SrvMsgHeader { wchar_t accountName[kMaxAccountNameLength]; ShaDigest namePassHash; - Uuid key; + plUUID key; uint32_t billingType; }; @@ -215,7 +215,7 @@ struct Srv2Db_AccountLoginRequest2 : SrvMsgHeader { }; struct Srv2Db_AccountLogout : SrvMsgHeader { - Uuid accountUuid; + plUUID accountUuid; uint32_t timeLoggedMins; }; @@ -235,16 +235,16 @@ struct Srv2Db_AccountSetBillingTypeRequest : SrvMsgHeader { }; struct Srv2Db_AccountActivateRequest : SrvMsgHeader { - Uuid activationKey; + plUUID activationKey; }; struct Srv2Db_AccountLockPlayerNameRequest :SrvMsgHeader { wchar_t playerName[kMaxPlayerNameLength]; - Uuid accountUuid; + plUUID accountUuid; }; struct Srv2Db_VaultNodeCreateRequest : SrvMsgHeader { - Uuid accountUuid; + plUUID accountUuid; uint32_t creatorId; uint32_t nodeBytes; uint8_t nodeBuffer[1]; @@ -256,11 +256,11 @@ struct Srv2Db_VaultNodeFetchRequest : SrvMsgHeader { struct Srv2Db_VaultNodeChanged : SrvMsgHeader { uint32_t nodeId; - Uuid revisionId; + plUUID revisionId; }; struct Srv2Db_VaultNodeSaveRequest : SrvMsgHeader { - Uuid revisionId; + plUUID revisionId; uint32_t nodeId; unsigned playerCheckId; unsigned isRequestFromAuth; @@ -321,7 +321,7 @@ struct Srv2Db_SetAgeSequenceNumRequest : SrvMsgHeader { struct Srv2Db_StateSaveObject : SrvMsgHeader { uint32_t buildId; - Uuid ownerId; + plUUID ownerId; wchar_t objectName[kMaxStateObjectName]; uint32_t objectDataBytes; uint8_t objectData[1]; @@ -329,12 +329,12 @@ struct Srv2Db_StateSaveObject : SrvMsgHeader { }; struct Srv2Db_StateDeleteObject : SrvMsgHeader { - Uuid ownerId; + plUUID ownerId; wchar_t objectName[kMaxStateObjectName]; }; struct Srv2Db_StateFetchObject : SrvMsgHeader { - Uuid ownerId; + plUUID ownerId; wchar_t objectName[kMaxStateObjectName]; }; @@ -400,11 +400,11 @@ struct Srv2Db_PlayerOffline : SrvMsgHeader { }; struct Srv2Db_AgeOnline : SrvMsgHeader { - Uuid ageInstId; + plUUID ageInstId; }; struct Srv2Db_AgeOffline : SrvMsgHeader { - Uuid ageInstId; + plUUID ageInstId; }; struct Srv2Db_CsrAcctInfoRequest : SrvMsgHeader { @@ -412,7 +412,7 @@ struct Srv2Db_CsrAcctInfoRequest : SrvMsgHeader { }; struct Srv2Db_FetchInviterInfo : SrvMsgHeader { - Uuid inviteUuid; + plUUID inviteUuid; }; @@ -427,16 +427,16 @@ struct Db2Srv_AccountExistsReply : SrvMsgHeader { }; struct Db2Srv_AccountCreateReply : SrvMsgHeader { - Uuid accountUuid; + plUUID accountUuid; }; struct Db2Srv_AccountCreateFromKeyReply : SrvMsgHeader { - Uuid accountUuid; - Uuid activationKey; + plUUID accountUuid; + plUUID activationKey; }; struct Db2Srv_AccountLoginReply : SrvMsgHeader { - Uuid accountUuid; + plUUID accountUuid; uint32_t accountFlags; uint32_t billingType; ShaDigest namePassHash; @@ -470,12 +470,12 @@ struct Db2Srv_SetAgeSequenceNumReply : SrvMsgHeader { }; struct Db2Srv_FetchInviterInfoReply : SrvMsgHeader { - Uuid hoodInstance; + plUUID hoodInstance; }; struct Db2Srv_StateObjectFetched : SrvMsgHeader { uint32_t buildId; - Uuid ownerId; + plUUID ownerId; wchar_t objectName[kMaxStateObjectName]; uint32_t objectDataBytes; uint8_t objectData[1]; @@ -484,7 +484,7 @@ struct Db2Srv_StateObjectFetched : SrvMsgHeader { struct Db2Srv_NotifyVaultNodeChanged : SrvMsgHeader { uint32_t nodeId; - Uuid revId; + plUUID revId; uint32_t notifyIdCount; uint32_t notifyIds[1]; }; @@ -545,7 +545,7 @@ struct Db2Srv_ScoreGetRanksReply : SrvMsgHeader { }; struct Db2Srv_CsrAcctInfoReply : SrvMsgHeader { - Uuid csrId; + plUUID csrId; uint32_t csrFlags; ShaDigest namePassHash; }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h index 87a00242..d9c9ddeb 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h @@ -125,8 +125,8 @@ struct Srv2Mcp_Connect { struct Srv2Mcp_AgeJoinRequest : SrvMsgHeader { wchar_t ageName[kMaxAgeNameLength]; - Uuid ageUuid; - Uuid accountUuid; + plUUID ageUuid; + plUUID accountUuid; uint32_t playerInt; uint8_t ccrLevel; wchar_t playerName[kMaxPlayerNameLength]; @@ -135,21 +135,21 @@ struct Srv2Mcp_AgeJoinRequest : SrvMsgHeader { struct Srv2Mcp_PlayerLoggedIn : SrvMsgHeader { uint32_t ageMcpId; - Uuid ageUuid; - Uuid accountUuid; + plUUID ageUuid; + plUUID accountUuid; wchar_t playerName[kMaxPlayerNameLength]; uint32_t playerInt; }; struct Srv2Mcp_PlayerLoggedOut : SrvMsgHeader { uint32_t ageMcpId; - Uuid accountUuid; + plUUID accountUuid; uint32_t playerInt; }; struct Srv2Mcp_AgeSpawned : SrvMsgHeader { wchar_t ageName[kMaxAgeNameLength]; - Uuid ageUuid; + plUUID ageUuid; uint32_t buildId; }; @@ -159,15 +159,15 @@ struct Srv2Mcp_AgeDied : SrvMsgHeader { struct Srv2Mcp_AccountLoginRequest : SrvMsgHeader { wchar_t accountName[kMaxAccountNameLength]; - Uuid accountUuid; + plUUID accountUuid; }; struct Srv2Mcp_AccountLogout : SrvMsgHeader { - Uuid accountUuid; + plUUID accountUuid; }; struct Srv2Mcp_AccountSetPlayer : SrvMsgHeader { - Uuid accountUuid; + plUUID accountUuid; uint32_t playerInt; }; @@ -192,14 +192,14 @@ struct Srv2Mcp_KickPlayer : SrvMsgHeader { struct Mcp2Srv_AgeJoinReply : SrvMsgHeader { uint32_t ageMcpId; - Uuid ageUuid; + plUUID ageUuid; uint32_t gameSrvNode; }; struct Mcp2Srv_AgeSpawnRequest : SrvMsgHeader { wchar_t ageName[kMaxAgeNameLength]; uint32_t ageMcpId; - Uuid ageUuid; + plUUID ageUuid; uint32_t buildId; }; @@ -209,15 +209,15 @@ struct Mcp2Srv_AgeUnspawn : SrvMsgHeader { struct Mcp2Srv_AgeAddPlayerRequest : SrvMsgHeader { uint32_t ageMcpId; - Uuid accountUuid; + plUUID accountUuid; uint32_t playerInt; uint8_t ccrLevel; wchar_t playerName[kMaxPlayerNameLength]; }; struct Mcp2Srv_AgeRemovePlayerRequest : SrvMsgHeader { - Uuid ageMcpId; - Uuid accountUuid; + plUUID ageMcpId; + plUUID accountUuid; uint32_t playerInt; }; @@ -230,7 +230,7 @@ struct Mcp2Srv_AccountLoginReply : SrvMsgHeader { }; struct Mcp2Srv_AccountNotifyKicked : SrvMsgHeader { - Uuid accountUuid; + plUUID accountUuid; uint32_t acctMcpId; ENetError reason; }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h index 31b364e9..5e5c6af4 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h @@ -95,12 +95,12 @@ struct Srv2State_Connect { ***/ struct Srv2State_FetchObject : SrvMsgHeader { - Uuid ownerId; + plUUID ownerId; wchar_t objectName[kMaxStateObjectName]; }; struct Srv2State_SaveObject : SrvMsgHeader { - Uuid ownerId; + plUUID ownerId; wchar_t objectName[kMaxStateObjectName]; uint32_t objectDataBytes; uint8_t objectData[1]; // objectData[objectDataBytes], actually @@ -108,7 +108,7 @@ struct Srv2State_SaveObject : SrvMsgHeader { }; struct Srv2State_DeleteObject : SrvMsgHeader { - Uuid ownerId; + plUUID ownerId; wchar_t objectName[kMaxStateObjectName]; }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h index 1187f2d0..0c808aca 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h @@ -169,7 +169,7 @@ struct Srv2Vault_Connect { ***/ struct Srv2Vault_PlayerCreateRequest : SrvMsgHeader { - Uuid accountUuid; + plUUID accountUuid; wchar_t playerName[kMaxPlayerNameLength]; wchar_t avatarShape[MAX_PATH]; wchar_t friendInvite[MAX_PATH]; @@ -177,21 +177,21 @@ struct Srv2Vault_PlayerCreateRequest : SrvMsgHeader { }; struct Srv2Vault_PlayerDeleteRequest : SrvMsgHeader { - Uuid accountId; + plUUID accountId; uint32_t playerId; }; struct Srv2Vault_UpgradeVisitorRequest : SrvMsgHeader { - Uuid accountId; + plUUID accountId; uint32_t playerId; }; struct Srv2Vault_AccountLoginRequest : SrvMsgHeader { - Uuid accountUuid; + plUUID accountUuid; }; struct Srv2Vault_AccountLogout : SrvMsgHeader { - Uuid accountUuid; + plUUID accountUuid; }; struct Srv2Vault_FetchChildNodeRefs : SrvMsgHeader { @@ -204,7 +204,7 @@ struct Srv2Vault_NodeFetch : SrvMsgHeader { }; struct Srv2Vault_CreateNodeRequest : SrvMsgHeader { - Uuid accountId; + plUUID accountId; uint32_t creatorId; uint32_t nodeBytes; uint8_t nodeBuffer[1]; @@ -220,7 +220,7 @@ struct Srv2Vault_NodeSave : SrvMsgHeader { uint32_t nodeId; unsigned playerCheckId; unsigned isRequestFromAuth; - Uuid revisionId; + plUUID revisionId; uint32_t nodeBytes; uint8_t nodeBuffer[1]; }; @@ -229,7 +229,7 @@ struct Srv2Vault_NodeSave2 : SrvMsgHeader { uint32_t nodeId; unsigned playerCheckId; unsigned isRequestFromAuth; - Uuid revisionId; + plUUID revisionId; uint32_t nodeBytes; uint8_t nodeBuffer[1]; }; @@ -270,28 +270,28 @@ struct Srv2Vault_SendNode : SrvMsgHeader { }; struct Srv2Vault_RegisterPlayerVault : SrvMsgHeader { - Uuid accountId; + plUUID accountId; uint32_t playerId; }; struct Srv2Vault_UnregisterPlayerVault : SrvMsgHeader { - Uuid accountId; + plUUID accountId; }; struct Srv2Vault_RegisterAgeVault : SrvMsgHeader { - Uuid accountId; + plUUID accountId; uint32_t ageId; // age's vault node id }; struct Srv2Vault_UnregisterAgeVault : SrvMsgHeader { - Uuid accountId; + plUUID accountId; }; struct Srv2Vault_AgeInitRequest : SrvMsgHeader { - Uuid accountId; + plUUID accountId; uint32_t playerId; - Uuid ageInstId; - Uuid parentAgeInstId; + plUUID ageInstId; + plUUID parentAgeInstId; uint32_t ageLanguage; uint32_t ageSequenceNumber; // packed fields: @@ -318,24 +318,24 @@ struct Srv2Vault_CurrentPopulationReply : SrvMsgHeader { }; struct Srv2Vault_ChangePlayerNameRequest : SrvMsgHeader { - Uuid accountId; + plUUID accountId; uint32_t playerId; wchar_t newName[kMaxPlayerNameLength]; }; struct Srv2Vault_AccountOnline : SrvMsgHeader { - Uuid acctId; + plUUID acctId; uint32_t buildId; uint32_t authNode; }; struct Srv2Vault_AccountOffline : SrvMsgHeader { - Uuid acctId; + plUUID acctId; uint32_t buildId; }; struct Srv2Vault_PlayerOnline : SrvMsgHeader { - Uuid acctId; + plUUID acctId; uint32_t buildId; uint32_t playerId; }; @@ -346,19 +346,19 @@ struct Srv2Vault_PlayerOffline : SrvMsgHeader { }; struct Srv2Vault_AgeOnline : SrvMsgHeader { - Uuid ageInstId; + plUUID ageInstId; uint32_t buildId; uint32_t gameNode; }; struct Srv2Vault_AgeOffline : SrvMsgHeader { - Uuid ageInstId; + plUUID ageInstId; uint32_t buildId; }; struct Srv2Vault_PlayerJoinedAge : SrvMsgHeader { uint32_t playerId; - Uuid ageInstId; + plUUID ageInstId; uint32_t buildId; }; @@ -400,24 +400,24 @@ struct Vault2Srv_NodeCreated : SrvMsgHeader { struct Vault2Srv_NodeChanged : SrvMsgHeader { uint32_t nodeId; - Uuid revisionId; - Uuid accountId; // the notify target + plUUID revisionId; + plUUID accountId; // the notify target }; struct Vault2Srv_NodeAdded : SrvMsgHeader { NetVaultNodeRef ref; - Uuid accountId; // the notify target + plUUID accountId; // the notify target }; struct Vault2Srv_NodeRemoved : SrvMsgHeader { uint32_t parentId; uint32_t childId; - Uuid accountId; // the notify target + plUUID accountId; // the notify target }; struct Vault2Srv_NodeDeleted : SrvMsgHeader { uint32_t nodeId; - Uuid accountId; // the notify target + plUUID accountId; // the notify target }; struct Vault2Srv_NodeFindReply : SrvMsgHeader { @@ -430,7 +430,7 @@ struct Vault2Srv_NodeFindReply : SrvMsgHeader { struct Vault2Srv_AgeInitReply : SrvMsgHeader { uint32_t ageNodeId; uint32_t ageInfoNodeId; - Uuid accountId; // the requestor + plUUID accountId; // the requestor }; struct Vault2Srv_PublicAgeList : SrvMsgHeader { @@ -441,12 +441,12 @@ struct Vault2Srv_PublicAgeList : SrvMsgHeader { struct Vault2Srv_NotifyAgeSDLChanged : SrvMsgHeader { wchar_t ageName[kMaxAgeNameLength]; - Uuid ageInstId; + plUUID ageInstId; }; struct Vault2Srv_CurrentPopulationRequest : SrvMsgHeader { uint32_t ageCount; - Uuid ageInstIds[1]; // [ageCount], actually + plUUID ageInstIds[1]; // [ageCount], actually // no more fields after var length alloc }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp index a48aa22f..51ffd96e 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp @@ -42,10 +42,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com /***************************************************************************** * * $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp -* +* ***/ #include "../Pch.h" +#include "pnUUID/pnUUID.h" #pragma hdrstop @@ -599,8 +600,8 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) { _ZERO(kCreateTime, IVaultNodeSetValue, createTime, (unsigned)0); _ZERO(kModifyTime, IVaultNodeSetValue, modifyTime, (unsigned)0); _ZEROSTRING(kCreateAgeName, IVaultNodeSetString, createAgeName, L""); - _ZERO(kCreateAgeUuid, IVaultNodeSetValue, createAgeUuid, kNilGuid); - _ZERO(kCreatorAcct, IVaultNodeSetValue, creatorAcct, kNilGuid); + _ZERO(kCreateAgeUuid, IVaultNodeSetValue, createAgeUuid, kNilUuid); + _ZERO(kCreatorAcct, IVaultNodeSetValue, creatorAcct, kNilUuid); _ZERO(kCreatorId, IVaultNodeSetValue, creatorId, (unsigned)0); _ZERO(kNodeType, IVaultNodeSetValue, nodeType, (unsigned)0); _ZERO(kInt32_1, IVaultNodeSetValue, int32_1, (signed)0); @@ -611,10 +612,10 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) { _ZERO(kUInt32_2, IVaultNodeSetValue, uint32_2, (unsigned)0); _ZERO(kUInt32_3, IVaultNodeSetValue, uint32_3, (unsigned)0); _ZERO(kUInt32_4, IVaultNodeSetValue, uint32_4, (unsigned)0); - _ZERO(kUuid_1, IVaultNodeSetValue, uuid_1, kNilGuid); - _ZERO(kUuid_2, IVaultNodeSetValue, uuid_2, kNilGuid); - _ZERO(kUuid_3, IVaultNodeSetValue, uuid_3, kNilGuid); - _ZERO(kUuid_4, IVaultNodeSetValue, uuid_4, kNilGuid); + _ZERO(kUuid_1, IVaultNodeSetValue, uuid_1, kNilUuid); + _ZERO(kUuid_2, IVaultNodeSetValue, uuid_2, kNilUuid); + _ZERO(kUuid_3, IVaultNodeSetValue, uuid_3, kNilUuid); + _ZERO(kUuid_4, IVaultNodeSetValue, uuid_4, kNilUuid); _ZEROSTRING(kString64_1, IVaultNodeSetString, string64_1, L""); _ZEROSTRING(kString64_2, IVaultNodeSetString, string64_2, L""); _ZEROSTRING(kString64_3, IVaultNodeSetString, string64_3, L""); @@ -706,12 +707,12 @@ void NetVaultNode::SetCreateAgeName (const wchar_t v[]) { } //============================================================================ -void NetVaultNode::SetCreateAgeUuid (const Uuid & v) { +void NetVaultNode::SetCreateAgeUuid (const plUUID& v) { IVaultNodeSetValue(kCreateAgeUuid, this, &createAgeUuid, v); } //============================================================================ -void NetVaultNode::SetCreatorAcct (const Uuid & v) { +void NetVaultNode::SetCreatorAcct (const plUUID& v) { IVaultNodeSetValue(kCreatorAcct, this, &creatorAcct, v); } @@ -766,22 +767,22 @@ void NetVaultNode::SetUInt32_4 (unsigned v) { } //============================================================================ -void NetVaultNode::SetUuid_1 (const Uuid & v) { +void NetVaultNode::SetUuid_1 (const plUUID& v) { IVaultNodeSetValue(kUuid_1, this, &uuid_1, v); } //============================================================================ -void NetVaultNode::SetUuid_2 (const Uuid & v) { +void NetVaultNode::SetUuid_2 (const plUUID& v) { IVaultNodeSetValue(kUuid_2, this, &uuid_2, v); } //============================================================================ -void NetVaultNode::SetUuid_3 (const Uuid & v) { +void NetVaultNode::SetUuid_3 (const plUUID& v) { IVaultNodeSetValue(kUuid_3, this, &uuid_3, v); } //============================================================================ -void NetVaultNode::SetUuid_4 (const Uuid & v) { +void NetVaultNode::SetUuid_4 (const plUUID& v) { IVaultNodeSetValue(kUuid_4, this, &uuid_4, v); } @@ -976,7 +977,7 @@ void NetVaultNodeFieldArray::GetFieldValueString_LCS ( case NetVaultNode::kUuid_2: case NetVaultNode::kUuid_3: case NetVaultNode::kUuid_4: { - plString tmp = plUUID(fieldAddr).AsString(); + plString tmp = plUUID((char*)fieldAddr).AsString(); StrPrintf(dst, dstChars, L"hextoraw('%s')", tmp.c_str()); } diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h index 1a3cef0c..5680d093 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h @@ -50,6 +50,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #endif #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPCOMMON_H +#include "pnUUID/pnUUID.h" + /***************************************************************************** * @@ -62,7 +64,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com const NetMsgField kNetMsgFieldAccountName = NET_MSG_FIELD_STRING(kMaxAccountNameLength); const NetMsgField kNetMsgFieldPlayerName = NET_MSG_FIELD_STRING(kMaxPlayerNameLength); const NetMsgField kNetMsgFieldShaDigest = NET_MSG_FIELD_RAW_DATA(sizeof(ShaDigest)); -const NetMsgField kNetMsgFieldUuid = NET_MSG_FIELD_DATA(sizeof(Uuid)); +const NetMsgField kNetMsgFieldUuid = NET_MSG_FIELD_DATA(sizeof(plUUID)); const NetMsgField kNetMsgFieldTransId = NET_MSG_FIELD_DWORD(); const NetMsgField kNetMsgFieldTimeMs = NET_MSG_FIELD_DWORD(); const NetMsgField kNetMsgFieldENetError = NET_MSG_FIELD_DWORD(); @@ -96,7 +98,7 @@ struct SrvPlayerInfo { ***/ struct NetAgeInfo { - Uuid ageInstId; + plUUID ageInstId; wchar_t ageFilename[kMaxAgeNameLength]; wchar_t ageInstName[kMaxAgeNameLength]; wchar_t ageUserName[kMaxAgeNameLength]; @@ -209,7 +211,7 @@ struct NetVaultNode : AtomicRef { uint64_t fieldFlags; uint64_t dirtyFlags; - Uuid revisionId; + plUUID revisionId; // Treat these as read-only or node flag fields will become invalid // Threaded apps: Must be accessed with node->critsect locked @@ -217,8 +219,8 @@ struct NetVaultNode : AtomicRef { unsigned createTime; unsigned modifyTime; wchar_t * createAgeName; - Uuid createAgeUuid; - Uuid creatorAcct; // accountId of node creator + plUUID createAgeUuid; + plUUID creatorAcct; // accountId of node creator unsigned creatorId; // playerId of node creator unsigned nodeType; int int32_1; @@ -229,10 +231,10 @@ struct NetVaultNode : AtomicRef { unsigned uint32_2; unsigned uint32_3; unsigned uint32_4; - Uuid uuid_1; - Uuid uuid_2; - Uuid uuid_3; - Uuid uuid_4; + plUUID uuid_1; + plUUID uuid_2; + plUUID uuid_3; + plUUID uuid_4; wchar_t * string64_1; wchar_t * string64_2; wchar_t * string64_3; @@ -261,8 +263,8 @@ struct NetVaultNode : AtomicRef { void SetCreateTime (unsigned v); void SetModifyTime (unsigned v); void SetCreateAgeName (const wchar_t v[]); - void SetCreateAgeUuid (const Uuid & v); - void SetCreatorAcct (const Uuid & v); + void SetCreateAgeUuid (const plUUID& v); + void SetCreatorAcct (const plUUID& v); void SetCreatorId (unsigned v); void SetNodeType (unsigned v); void SetInt32_1 (int v); @@ -273,10 +275,10 @@ struct NetVaultNode : AtomicRef { void SetUInt32_2 (unsigned v); void SetUInt32_3 (unsigned v); void SetUInt32_4 (unsigned v); - void SetUuid_1 (const Uuid & v); - void SetUuid_2 (const Uuid & v); - void SetUuid_3 (const Uuid & v); - void SetUuid_4 (const Uuid & v); + void SetUuid_1 (const plUUID& v); + void SetUuid_2 (const plUUID& v); + void SetUuid_3 (const plUUID& v); + void SetUuid_4 (const plUUID& v); void SetString64_1 (const wchar_t v[]); void SetString64_2 (const wchar_t v[]); void SetString64_3 (const wchar_t v[]); @@ -298,8 +300,8 @@ struct NetVaultNode : AtomicRef { inline unsigned GetCreateTime () const { return createTime; } inline unsigned GetModifyTime () const { return modifyTime; } inline wchar_t * GetCreateAgeName () const { return createAgeName; } - inline Uuid GetCreateAgeUuid () const { return createAgeUuid; } - inline Uuid GetCreatorAcct () const { return creatorAcct; } + inline plUUID GetCreateAgeUuid () const { return createAgeUuid; } + inline plUUID GetCreatorAcct () const { return creatorAcct; } inline unsigned GetCreatorId () const { return creatorId; } inline unsigned GetNodeType () const { return nodeType; } inline int GetInt32_1 () const { return int32_1; } @@ -310,10 +312,10 @@ struct NetVaultNode : AtomicRef { inline unsigned GetUInt32_2 () const { return uint32_2; } inline unsigned GetUInt32_3 () const { return uint32_3; } inline unsigned GetUInt32_4 () const { return uint32_4; } - inline Uuid GetUuid_1 () const { return uuid_1; } - inline Uuid GetUuid_2 () const { return uuid_2; } - inline Uuid GetUuid_3 () const { return uuid_3; } - inline Uuid GetUuid_4 () const { return uuid_4; } + inline plUUID GetUuid_1 () const { return uuid_1; } + inline plUUID GetUuid_2 () const { return uuid_2; } + inline plUUID GetUuid_3 () const { return uuid_3; } + inline plUUID GetUuid_4 () const { return uuid_4; } inline wchar_t * GetString64_1 () const { return string64_1; } inline wchar_t * GetString64_2 () const { return string64_2; } inline wchar_t * GetString64_3 () const { return string64_3; } diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp index ca27ff5a..05bbc5ca 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp @@ -42,6 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnUUID.h" #include "hsStream.h" +const plUUID kNilUuid; + plUUID::plUUID() { Clear(); @@ -57,11 +59,6 @@ plUUID::plUUID(const plUUID& other) CopyFrom(&other); } -plUUID::plUUID(const Uuid& uuid) -{ - memcpy(fData, uuid.data, sizeof(fData)); -} - void plUUID::Read(hsStream* s) { s->LogSubStreamPushDesc("plUUID"); @@ -79,10 +76,3 @@ plString plUUID::AsString() const ToString(str); return str; } - -plUUID::operator Uuid () const -{ - Uuid uuid; - memcpy(uuid.data, fData, sizeof(uuid.data)); - return uuid; -} diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h index 890f6294..d9ac5849 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h @@ -43,10 +43,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define pnUUID_h_inc #include "HeadSpin.h" -#include "pnUtils/pnUtUuid.h" +#include "plString.h" class hsStream; -class plString; + +extern const class plUUID kNilUuid; class plUUID { @@ -63,7 +64,6 @@ public: plUUID(); plUUID(const plString& s); plUUID(const plUUID& other); - plUUID(const Uuid& uuid); void Clear(); bool IsNull() const; @@ -92,7 +92,6 @@ public: return CompareTo(&other) == -1; } operator plString (void) const { return AsString(); } - operator Uuid () const; static plUUID Generate(); }; diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp index 7cc270e7..2154bfa1 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp @@ -64,7 +64,7 @@ struct plUUIDHelper void plUUID::Clear() { uuid_t g; - plUUIDHelper::CopyToNative( g, this ); + //plUUIDHelper::CopyToNative( g, this ); uuid_clear( g ); plUUIDHelper::CopyToPlasma( this, g ); } @@ -98,11 +98,16 @@ bool plUUID::IsEqualTo( const plUUID * v ) const bool plUUID::FromString( const char * str ) { Clear(); - if ( !str ) + if (!str) { return false; + } + uuid_t g; - uuid_parse( str, g ); - plUUIDHelper::CopyToPlasma( this, g ); + if (uuid_parse(str, g) != 0) { + return false; + } + + plUUIDHelper::CopyToPlasma(this, g); return true; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt b/Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt index 3e46f898..ab6c127e 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt +++ b/Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt @@ -19,7 +19,6 @@ set(pnUtils_HEADERS pnUtSort.h pnUtStr.h pnUtTime.h - pnUtUuid.h ) set(pnUtils_SOURCES @@ -32,7 +31,6 @@ set(pnUtils_SOURCES pnUtPath.cpp pnUtStr.cpp pnUtTime.cpp - pnUtUuid.cpp ) if(WIN32) @@ -40,12 +38,10 @@ if(WIN32) Win32/pnUtW32Misc.cpp Win32/pnUtW32Path.cpp Win32/pnUtW32Str.cpp - Win32/pnUtW32Uuid.cpp ) else() set(pnUtils_UNIX Unix/pnUtUxStr.cpp - Unix/pnUtUxUuid.cpp ) endif() diff --git a/Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp b/Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp deleted file mode 100644 index 9e286384..00000000 --- a/Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/Unix/pnUtUxUuid.cpp -* -***/ - -#include "../pnUtUuid.h" - -/***************************************************************************** -* -* Uuid Unix implementation -* -***/ - -#ifdef HS_BUILD_FOR_UNIX - -#include - -static_assert(sizeof(Uuid) >= sizeof(uuid_t), "UUID size does not match uuid_t"); - -#else - -// Dummy function to prevent a linker warning complaining about no public symbols if the -// contents of the file get compiled out via pre-processor -void UxUuidPreventLNK4221Warning () { -} - -#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp b/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp deleted file mode 100644 index 24ce023a..00000000 --- a/Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Uuid.cpp -* -***/ - -#include "../pnUtils.h" -#include -#include - -#if 0 - -void Uuid::Clear() -{ - UuidCreateNil( (GUID *)this ); -} - -int Uuid::CompareTo( const Uuid * v ) const -{ - RPC_STATUS s; - return UuidCompare( (GUID *)this, (GUID *)v, &s ); -} - -bool Uuid::IsEqualTo( const Uuid * v ) const -{ - return ( CompareTo( v )==0 ); -} - -void Uuid::CopyFrom( const Uuid * v ) -{ - memcpy( (void*)fData, (const void*)v->fData, sizeof(fData) ); -} - -bool Uuid::IsNull() const -{ - RPC_STATUS s; - return 1 == UuidIsNil( (GUID *)this, &s ); -} - -bool Uuid::FromString( const char * str ) -{ - Clear(); - if ( !str ) - return false; - return RPC_S_OK == UuidFromString( (unsigned char *)str, (GUID *)this ); -} - -bool Uuid::ToString( std::string & out ) const -{ - out = ""; - unsigned char * ubuf; - RPC_STATUS s; - s = UuidToString( (GUID *) this, &ubuf ); - bool success = ( s==RPC_S_OK ); - if ( success ) - out = (char*)ubuf; - RpcStringFree( &ubuf ); - return success; -} - -// static -Uuid Uuid::Generate() -{ - Uuid result; - UuidCreate( (GUID *)&result ); - return result; -} - -#endif - - -#ifdef HS_BUILD_FOR_WIN32 - -/***************************************************************************** -* -* Exports -* -***/ - -static_assert(sizeof(Uuid) >= sizeof(GUID), "pnUtils Uuid and Win32 GUID types differ in size"); - - - -//============================================================================ -bool GuidFromString (const wchar_t str[], Uuid * uuid) { - ASSERT(uuid); - static_assert(sizeof(wchar_t) == sizeof(unsigned short), "Wchar is not an uint16"); - return RPC_S_OK == UuidFromStringW((unsigned short *) str, (GUID *) uuid); -} - -//============================================================================ -bool GuidFromString (const char str[], Uuid * uuid) { - ASSERT(uuid); - return RPC_S_OK == UuidFromStringA((unsigned char *) str, (GUID *) uuid); -} - -//============================================================================ -int GuidCompare (const Uuid & a, const Uuid & b) { - RPC_STATUS s; - return UuidCompare((GUID *)&a, (GUID *)&b, &s); -} - -//============================================================================ -bool GuidIsNil (const Uuid & uuid) { - RPC_STATUS s; - return 1 == UuidIsNil((GUID *)&uuid, &s ); -} - -#endif // HS_BUILD_FOR_WIN32 diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h index 3b7bda2d..fc83886e 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h @@ -51,7 +51,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnUtCoreLib.h" // must be first in list #include "pnUtPragma.h" -#include "pnUtUuid.h" #include "pnUtSort.h" #include "pnUtArray.h" #include "pnUtList.h" diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp deleted file mode 100644 index 4745c3da..00000000 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.cpp -* -***/ - -#include "pnUtUuid.h" -#include "pnUtHash.h" -#include "pnUtStr.h" - - -const Uuid kNilGuid; - - -/***************************************************************************** -* -* Exports -* -***/ - -//============================================================================ -Uuid::Uuid (const wchar_t str[]) { - - GuidFromString(str, this); -} diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h deleted file mode 100644 index daae5008..00000000 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h +++ /dev/null @@ -1,110 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.h -* -***/ - -#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTUUID_H -#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTUUID_H - -#include "Pch.h" - -/***************************************************************************** -* -* Types -* -***/ - -struct Uuid; - -/***************************************************************************** -* -* Constants -* -***/ - -extern const Uuid kNilGuid; - - -/***************************************************************************** -* -* Functions -* -***/ - -// Using 'Guid' here instead of 'Uuid' to avoid name clash with windows API =( - -bool GuidFromString (const wchar_t str[], Uuid * uuid); -bool GuidFromString (const char str[], Uuid * uuid); -int GuidCompare (const Uuid & a, const Uuid & b); -inline bool GuidsAreEqual (const Uuid & a, const Uuid & b) { return 0 == GuidCompare(a, b); } -bool GuidIsNil (const Uuid & uuid); - - -/***************************************************************************** -* -* Uuid -* -***/ - -#pragma pack(push, 1) -struct Uuid { - union { - uint32_t uint32_ts[4]; - uint8_t data[16]; - }; - - Uuid () {} - Uuid (const wchar_t str[]); - operator bool () const { return !GuidIsNil(*this); } - inline bool operator ! () const { return GuidIsNil(*this); } - inline bool operator < (const Uuid & rhs) const { return GuidCompare(*this, rhs) < 0; } - inline bool operator == (const Uuid & rhs) const { return GuidsAreEqual(*this, rhs); } - inline bool operator == (int rhs) const { ASSERT(!rhs); return GuidsAreEqual(*this, kNilGuid); } - inline bool operator != (const Uuid & rhs) const { return !GuidsAreEqual(*this, rhs); } - inline bool operator != (int rhs) const { ASSERT(!rhs); return !GuidsAreEqual(*this, kNilGuid); } -}; -#pragma pack(pop) - -#endif diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp index c15f9e6a..80275072 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp @@ -261,7 +261,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgSDLState) nc->ErrorMsg(err.c_str()); // Post Quit message - nc->QueueDisableNet(true, "SDL Desc Problem"); + nc->QueueDisableNet(true, "SDL Desc Problem"); delete sdRec; } else if( sdRec->Read( &stream, 0, rwFlags ) ) diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index 3948eae6..23c4fc72 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -419,7 +419,7 @@ void plNetLinkingMgr::IDoLink(plLinkToAgeMsg* msg) // Queue join op NlmJoinAgeOp * joinAgeOp = NEWZERO(NlmJoinAgeOp); - joinAgeOp->age.ageInstId = (Uuid) *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid(); + joinAgeOp->age.ageInstId = *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid(); StrCopy( joinAgeOp->age.ageDatasetName, GetAgeLink()->GetAgeInfo()->GetAgeFilename(), @@ -768,7 +768,7 @@ void plNetLinkingMgr::IPostProcessLink( void ) if (RelVaultNode* rvnInfo = VaultGetPlayerInfoNodeIncRef()) { VaultPlayerInfoNode accInfo(rvnInfo); wchar_t ageInstName[MAX_PATH]; - Uuid ageInstGuid = *info->GetAgeInstanceGuid(); + plUUID ageInstGuid = *info->GetAgeInstanceGuid(); StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName)); accInfo.SetAgeInstName(ageInstName); accInfo.SetAgeInstUuid(ageInstGuid); @@ -863,7 +863,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) if (RelVaultNode * rvnInfo = VaultGetPlayerInfoNodeIncRef()) { VaultPlayerInfoNode accInfo(rvnInfo); accInfo.SetAgeInstName(nil); - accInfo.SetAgeInstUuid(kNilGuid); + accInfo.SetAgeInstUuid(kNilUuid); accInfo.SetOnline(false); rvnInfo->DecRef(); } @@ -872,7 +872,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) if (RelVaultNode * rvnInfo = VaultGetPlayerInfoNodeIncRef()) { VaultPlayerInfoNode accInfo(rvnInfo); wchar_t ageInstName[MAX_PATH]; - Uuid ageInstGuid = *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid(); + plUUID ageInstGuid = *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid(); StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName)); accInfo.SetAgeInstName(ageInstName); accInfo.SetAgeInstUuid(ageInstGuid); diff --git a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp index 99728029..a8c70264 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp @@ -121,7 +121,7 @@ static wchar_t s_iniAuthToken[kMaxPublisherAuthKeyLength]; static wchar_t s_iniOS[kMaxGTOSIdLength]; static bool s_iniReadAccountInfo = true; static wchar_t s_iniStartupAgeName[kMaxAgeNameLength]; -static Uuid s_iniStartupAgeInstId; +static plUUID s_iniStartupAgeInstId; static wchar_t s_iniStartupPlayerName[kMaxPlayerNameLength]; static bool s_netError = false; @@ -382,7 +382,7 @@ static void INetCliAuthLoginSetPlayerRequestCallback ( static void INetCliAuthLoginRequestCallback ( ENetError result, void * param, - const Uuid & accountUuid, + const plUUID& accountUuid, unsigned accountFlags, unsigned billingType, const NetCliAuthPlayerInfo playerInfoArr[], @@ -417,7 +417,7 @@ static void INetCliAuthLoginRequestCallback ( } } else - s_account.accountUuid = kNilGuid; + s_account.accountUuid = kNilUuid; // If they specified an alternate age, but we couldn't find the player, force // the StartUp age to load so that they may select/create a player first. @@ -590,7 +590,7 @@ static void INetCliAuthAgeRequestCallback ( void * param, unsigned ageMcpId, unsigned ageVaultId, - const Uuid & ageInstId, + const plUUID& ageInstId, plNetAddress gameAddr ) { if (!IS_NET_ERROR(result) || result == kNetErrVaultNodeNotFound) { @@ -598,7 +598,7 @@ static void INetCliAuthAgeRequestCallback ( s_age.ageVaultId = ageVaultId; plString gameAddrStr = gameAddr.GetHostString(); - plString ageInstIdStr = plUUID(ageInstId).AsString(); + plString ageInstIdStr = ageInstId.AsString(); LogMsg( kLogPerf, @@ -1121,7 +1121,7 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg if (RelVaultNode* rvn = VaultGetPlayerInfoNodeIncRef()) { VaultPlayerInfoNode pInfo(rvn); pInfo.SetAgeInstName(nil); - pInfo.SetAgeInstUuid(kNilGuid); + pInfo.SetAgeInstUuid(kNilUuid); pInfo.SetOnline(false); NetCliAuthVaultNodeSave(rvn, nil, nil); @@ -1245,14 +1245,14 @@ void NetCommSetAgePublic ( // --> no msg //============================================================================ void NetCommCreatePublicAge (// --> plNetCommPublicAgeMsg const char ageName[], - const Uuid & ageInstId, + const plUUID& ageInstId, void * param ) { } //============================================================================ void NetCommRemovePublicAge(// --> plNetCommPublicAgeMsg - const Uuid & ageInstId, + const plUUID& ageInstId, void * param ) { } @@ -1285,7 +1285,7 @@ void NetCommRegisterVisitAge ( //============================================================================ void NetCommUnregisterVisitAge ( - const Uuid & ageInstId, + const plUUID& ageInstId, unsigned playerInt, void * param ) { @@ -1299,7 +1299,7 @@ void NetCommConnectPlayerVault ( //============================================================================ void NetCommConnectAgeVault ( - const Uuid & ageInstId, + const plUUID& ageInstId, void * param ) { } @@ -1333,7 +1333,7 @@ void NetCommSetCCRLevel ( void NetCommSendFriendInvite ( const wchar_t emailAddress[], const wchar_t toName[], - const Uuid& inviteUuid + const plUUID& inviteUuid ) { NetCliAuthSendFriendInvite( emailAddress, diff --git a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h index 8dd0c0e9..99152bc9 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h +++ b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h @@ -79,7 +79,7 @@ struct NetCommPlayer { }; struct NetCommAccount { - Uuid accountUuid; + plUUID accountUuid; wchar_t accountName[kMaxAccountNameLength]; ShaDigest accountNamePassHash; char accountNameAnsi[kMaxAccountNameLength]; @@ -88,7 +88,7 @@ struct NetCommAccount { }; struct NetCommAge { - Uuid ageInstId; + plUUID ageInstId; unsigned ageVaultId; char ageDatasetName[kMaxAgeNameLength]; char spawnPtName[64]; @@ -232,11 +232,11 @@ void NetCommSetAgePublic ( // --> no msg ); void NetCommCreatePublicAge (// --> plNetCommPublicAgeMsg const char ageName[], - const Uuid & ageInstId, + const plUUID& ageInstId, void * param ); void NetCommRemovePublicAge(// --> plNetCommPublicAgeMsg - const Uuid & ageInstId, + const plUUID& ageInstId, void * param ); void NetCommRegisterOwnedAge ( @@ -257,7 +257,7 @@ void NetCommRegisterVisitAge ( void * param ); void NetCommUnregisterVisitAge ( - const Uuid & ageInstId, + const plUUID& ageInstId, unsigned playerInt, void * param ); @@ -266,7 +266,7 @@ void NetCommConnectPlayerVault ( ); void NetCommDisconnectPlayerVault (); void NetCommConnectAgeVault ( - const Uuid & ageInstId, + const plUUID& ageInstId, void * param ); void NetCommDisconnectAgeVault (); @@ -280,7 +280,7 @@ void NetCommSetCCRLevel ( void NetCommSendFriendInvite ( const wchar_t emailAddress[], const wchar_t toName[], - const Uuid& inviteUuid + const plUUID& inviteUuid ); #endif // PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETCLIENTCOMM_PLNETCLIENTCOMM_H diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp index a6fa421e..0e82c23f 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp @@ -92,7 +92,7 @@ struct CliAuConn : AtomicRef { NetCli * cli; char name[MAX_PATH]; plNetAddress addr; - Uuid token; + plUUID token; unsigned seq; unsigned serverChallenge; AsyncCancelId cancelId; @@ -161,7 +161,7 @@ struct LoginRequestTrans : NetAuthTrans { FNetCliAuthLoginRequestCallback m_callback; void * m_param; - Uuid m_accountId; + plUUID m_accountId; unsigned m_accountFlags; unsigned m_billingType; unsigned m_playerCount; @@ -195,13 +195,13 @@ struct AgeRequestTrans : NetAuthTrans { void * m_param; wchar_t m_ageName[kMaxAgeNameLength]; unsigned m_ageMcpId; - Uuid m_ageInstId; + plUUID m_ageInstId; unsigned m_ageVaultId; uint32_t m_gameSrvNode; AgeRequestTrans ( const wchar_t ageName[], - const Uuid & ageInstId, + const plUUID& ageInstId, FNetCliAuthAgeRequestCallback callback, void * param ); @@ -229,7 +229,7 @@ struct AccountCreateRequestTrans : NetAuthTrans { unsigned m_billingType; // recv - Uuid m_accountId; + plUUID m_accountId; AccountCreateRequestTrans ( const wchar_t accountName[], @@ -258,17 +258,17 @@ struct AccountCreateFromKeyRequestTrans : NetAuthTrans { // send wchar_t m_accountName[kMaxAccountNameLength]; ShaDigest m_namePassHash; - Uuid m_key; + plUUID m_key; unsigned m_billingType; // recv - Uuid m_accountId; - Uuid m_activationKey; + plUUID m_accountId; + plUUID m_activationKey; - AccountCreateFromKeyRequestTrans ( - const wchar_t accountName[], - const wchar_t password[], - const Uuid & key, + AccountCreateFromKeyRequestTrans( + const wchar_t accountName[], + const wchar_t password[], + const plUUID& key, unsigned billingType, FNetCliAuthAccountCreateFromKeyRequestCallback callback, void * param @@ -505,10 +505,10 @@ struct AccountActivateRequestTrans : NetAuthTrans { void * m_param; // send - Uuid m_activationKey; + plUUID m_activationKey; AccountActivateRequestTrans ( - const Uuid & activationKey, + const plUUID& activationKey, FNetCliAuthAccountActivateRequestCallback callback, void * param ); @@ -609,7 +609,7 @@ struct RcvdPropagatedBufferTrans : NetNotifyTrans { struct VaultNodeChangedTrans : NetNotifyTrans { unsigned m_nodeId; - Uuid m_revId; + plUUID m_revId; VaultNodeChangedTrans () : NetNotifyTrans(kVaultNodeChangedTrans) {} void Post (); @@ -683,8 +683,8 @@ struct VaultInitAgeTrans : NetAuthTrans { FNetCliAuthAgeInitCallback m_callback; void * m_param; - Uuid m_ageInstId; - Uuid m_parentAgeInstId; + plUUID m_ageInstId; + plUUID m_parentAgeInstId; wchar_t * m_ageFilename; wchar_t * m_ageInstName; wchar_t * m_ageUserName; @@ -695,15 +695,15 @@ struct VaultInitAgeTrans : NetAuthTrans { unsigned m_ageId; unsigned m_ageInfoId; - VaultInitAgeTrans ( + VaultInitAgeTrans( FNetCliAuthAgeInitCallback callback, // optional void * param, // optional - const Uuid & ageInstId, // optional. is used in match - const Uuid & parentAgeInstId, // optional. is used in match - const wchar_t ageFilename[], // optional. is used in match - const wchar_t ageInstName[], // optional. not used in match - const wchar_t ageUserName[], // optional. not used in match - const wchar_t ageDesc[], // optional. not used in match + const plUUID& ageInstId, // optional. is used in match + const plUUID& parentAgeInstId, // optional. is used in match + const wchar_t ageFilename[], // optional. is used in match + const wchar_t ageInstName[], // optional. not used in match + const wchar_t ageUserName[], // optional. not used in match + const wchar_t ageDesc[], // optional. not used in match unsigned ageSequenceNumber, // optional. not used in match unsigned ageLanguage // optional. not used in match ); @@ -800,14 +800,14 @@ struct VaultCreateNodeTrans : NetAuthTrans { struct VaultSaveNodeTrans : NetAuthTrans { unsigned m_nodeId; - Uuid m_revisionId; + plUUID m_revisionId; ARRAY(uint8_t) m_buffer; FNetCliAuthVaultNodeSaveCallback m_callback; void * m_param; VaultSaveNodeTrans ( unsigned nodeId, - const Uuid & revisionId, + const plUUID& revisionId, unsigned dataCount, const void * data, FNetCliAuthVaultNodeSaveCallback callback, @@ -945,12 +945,12 @@ struct SendFriendInviteTrans : NetAuthTrans { // send wchar_t m_emailAddress[kMaxEmailAddressLength]; wchar_t m_toName[kMaxPlayerNameLength]; - Uuid m_inviteUuid; + plUUID m_inviteUuid; - SendFriendInviteTrans ( - const wchar_t emailAddr[], - const wchar_t toName[], - const Uuid & inviteUuid, + SendFriendInviteTrans( + const wchar_t emailAddr[], + const wchar_t toName[], + const plUUID& inviteUuid, FNetCliAuthSendFriendInviteCallback callback, void * param ); @@ -1371,7 +1371,7 @@ static void CheckedReconnect (CliAuConn * conn, ENetError error) { ReportNetError(kNetProtocolCli2Auth, error); } else { - if (conn->token != kNilGuid) + if (conn->token != kNilUuid) // previously encrypted; reconnect quickly conn->reconnectStartMs = GetNonZeroTimeMs() + 500; else @@ -2595,7 +2595,7 @@ LoginRequestTrans::LoginRequestTrans ( ) : NetAuthTrans(kLoginRequestTrans) , m_callback(callback) , m_param(param) -, m_accountId(kNilGuid) +, m_accountId(kNilUuid) , m_accountFlags(0) , m_playerCount(0) { @@ -2717,7 +2717,7 @@ bool LoginRequestTrans::Recv ( //============================================================================ AgeRequestTrans::AgeRequestTrans ( const wchar_t ageName[], - const Uuid & ageInstId, + const plUUID& ageInstId, FNetCliAuthAgeRequestCallback callback, void * param ) : NetAuthTrans(kAgeRequestTrans) @@ -2859,7 +2859,7 @@ bool AccountCreateRequestTrans::Recv ( AccountCreateFromKeyRequestTrans::AccountCreateFromKeyRequestTrans ( const wchar_t accountName[], const wchar_t password[], - const Uuid & key, + const plUUID& key, unsigned billingType, FNetCliAuthAccountCreateFromKeyRequestCallback callback, void * param @@ -3394,7 +3394,7 @@ bool AccountSetBillingTypeRequestTrans::Recv ( //============================================================================ AccountActivateRequestTrans::AccountActivateRequestTrans ( - const Uuid & activationKey, + const plUUID& activationKey, FNetCliAuthAccountActivateRequestCallback callback, void * param ) : NetAuthTrans(kAccountActivateRequestTrans) @@ -3805,12 +3805,12 @@ bool VaultFetchNodeRefsTrans::Recv ( VaultInitAgeTrans::VaultInitAgeTrans ( FNetCliAuthAgeInitCallback callback, // optional void * param, // optional - const Uuid & ageInstId, // optional. is used in match - const Uuid & parentAgeInstId, // optional. is used in match - const wchar_t ageFilename[], // optional. is used in match - const wchar_t ageInstName[], // optional. not used in match - const wchar_t ageUserName[], // optional. not used in match - const wchar_t ageDesc[], // optional. not used in match + const plUUID& ageInstId, // optional. is used in match + const plUUID& parentAgeInstId, // optional. is used in match + const wchar_t ageFilename[], // optional. is used in match + const wchar_t ageInstName[], // optional. not used in match + const wchar_t ageUserName[], // optional. not used in match + const wchar_t ageDesc[], // optional. not used in match unsigned ageSequenceNumber, // optional. not used in match unsigned ageLanguage // optional. not used in match ) : NetAuthTrans(kVaultInitAgeTrans) @@ -4100,7 +4100,7 @@ bool VaultCreateNodeTrans::Recv ( //============================================================================ VaultSaveNodeTrans::VaultSaveNodeTrans ( unsigned nodeId, - const Uuid & revisionId, + const plUUID& revisionId, unsigned dataCount, const void * data, FNetCliAuthVaultNodeSaveCallback callback, @@ -4415,9 +4415,9 @@ bool ChangePlayerNameRequestTrans::Recv ( //============================================================================ SendFriendInviteTrans::SendFriendInviteTrans ( - const wchar_t emailAddr[], - const wchar_t toName[], - const Uuid & inviteUuid, + const wchar_t emailAddr[], + const wchar_t toName[], + const plUUID& inviteUuid, FNetCliAuthSendFriendInviteCallback callback, void * param ) : NetAuthTrans(kSendFriendInviteTrans) @@ -4521,7 +4521,7 @@ bool ScoreCreateTrans::Send () { m_ownerId, (uintptr_t) wgameName, m_gameType, - m_value + (uintptr_t)m_value }; m_conn->Send(msg, arrsize(msg)); @@ -4727,7 +4727,7 @@ bool ScoreAddPointsTrans::Send () { kCli2Auth_ScoreAddPoints, m_transId, m_scoreId, - m_numPoints, + (uintptr_t)m_numPoints, }; m_conn->Send(msg, arrsize(msg)); @@ -4789,7 +4789,7 @@ bool ScoreTransferPointsTrans::Send () { m_transId, m_srcScoreId, m_destScoreId, - m_numPoints, + (uintptr_t)m_numPoints, }; m_conn->Send(msg, arrsize(msg)); @@ -4848,7 +4848,7 @@ bool ScoreSetPointsTrans::Send () { kCli2Auth_ScoreSetPoints, m_transId, m_scoreId, - m_numPoints, + (uintptr_t)m_numPoints, }; m_conn->Send(msg, arrsize(msg)); @@ -5249,7 +5249,7 @@ void NetCliAuthLoginRequest ( //============================================================================ void NetCliAuthAgeRequest ( const wchar_t ageName[], - const Uuid & ageInstId, + const plUUID& ageInstId, FNetCliAuthAgeRequestCallback callback, void * param ) { @@ -5296,7 +5296,7 @@ void NetCliAuthAccountCreateRequest ( void NetCliAuthAccountCreateFromKeyRequest ( const wchar_t accountName[], const wchar_t password[], - Uuid key, + plUUID key, unsigned billingType, FNetCliAuthAccountCreateFromKeyRequestCallback callback, void * param @@ -5482,7 +5482,7 @@ void NetCliAuthAccountSetBillingTypeRequest ( //============================================================================ void NetCliAuthAccountActivateRequest ( - const Uuid & activationKey, + const plUUID& activationKey, FNetCliAuthAccountActivateRequestCallback callback, void * param ) { @@ -5624,7 +5624,7 @@ unsigned NetCliAuthVaultNodeSave ( node->dirtyFlags |= NetVaultNode::kNodeType; // We're definitely saving this node, so assign a revisionId - node->revisionId = (Uuid)plUUID::Generate(); + node->revisionId = plUUID::Generate(); ARRAY(uint8_t) buffer; unsigned bytes = node->Write_LCS(&buffer, NetVaultNode::kRwDirtyOnly | NetVaultNode::kRwUpdateDirty); @@ -5740,8 +5740,8 @@ void NetCliAuthVaultSendNode ( //============================================================================ void NetCliAuthVaultInitAge ( - const Uuid & ageInstId, // optional. is used in match - const Uuid & parentAgeInstId, // optional. is used in match + const plUUID& ageInstId, // optional. is used in match + const plUUID& parentAgeInstId, // optional. is used in match const wchar_t ageFilename[], // optional. is used in match const wchar_t ageInstName[], // optional. not used in match const wchar_t ageUserName[], // optional. not used in match @@ -5913,7 +5913,7 @@ void NetCliAuthChangePlayerNameRequest ( void NetCliAuthSendFriendInvite ( const wchar_t emailAddress[], const wchar_t toName[], - const Uuid& inviteUuid, + const plUUID& inviteUuid, FNetCliAuthSendFriendInviteCallback callback, void * param ) { diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h index 5ebeb223..a8080cbb 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h @@ -128,7 +128,7 @@ struct NetCliAuthPlayerInfo { typedef void (*FNetCliAuthLoginRequestCallback)( ENetError result, void * param, - const Uuid & accountId, + const plUUID& accountId, unsigned accountFlags, unsigned billingType, const NetCliAuthPlayerInfo playerInfoArr[], @@ -162,7 +162,7 @@ void NetCliAuthSetPlayerRequest ( typedef void (*FNetCliAuthAccountCreateRequestCallback)( ENetError result, void * param, - const Uuid & accountId + const plUUID& accountId ); void NetCliAuthAccountCreateRequest ( const wchar_t accountName[], @@ -179,13 +179,13 @@ void NetCliAuthAccountCreateRequest ( typedef void (*FNetCliAuthAccountCreateFromKeyRequestCallback)( ENetError result, void * param, - const Uuid & accountId, - const Uuid & activationKey + const plUUID& accountId, + const plUUID& activationKey ); void NetCliAuthAccountCreateFromKeyRequest ( const wchar_t accountName[], const wchar_t accountPass[], - Uuid key, + plUUID key, unsigned billingType, FNetCliAuthAccountCreateFromKeyRequestCallback callback, void * param @@ -313,7 +313,7 @@ typedef void (*FNetCliAuthAccountActivateRequestCallback)( void * param ); void NetCliAuthAccountActivateRequest ( - const Uuid & activationKey, + const plUUID& activationKey, FNetCliAuthAccountActivateRequestCallback callback, void * param ); @@ -326,12 +326,12 @@ typedef void (*FNetCliAuthAgeRequestCallback)( void * param, unsigned ageMcpId, unsigned ageVaultId, - const Uuid & ageInstId, + const plUUID& ageInstId, plNetAddress gameAddr ); void NetCliAuthAgeRequest ( const wchar_t ageName[], // L"Teledahn" - const Uuid & ageInstId, + const plUUID& ageInstId, FNetCliAuthAgeRequestCallback callback, void * param ); @@ -389,7 +389,7 @@ struct NetVaultNodeRef; // VaultNodeChanged typedef void (*FNetCliAuthVaultNodeChanged)( unsigned nodeId, - const Uuid & revisionId + const plUUID& revisionId ); void NetCliAuthVaultSetRecvNodeChangedHandler ( FNetCliAuthVaultNodeChanged handler @@ -519,8 +519,8 @@ typedef void (*FNetCliAuthAgeInitCallback) ( unsigned ageInfoVaultId ); void NetCliAuthVaultInitAge ( - const Uuid & ageInstId, // optional. is used in match - const Uuid & parentAgeInstId, // optional. is used in match + const plUUID& ageInstId, // optional. is used in match + const plUUID& parentAgeInstId, // optional. is used in match const wchar_t ageFilename[], // optional. is used in match const wchar_t ageInstName[], // optional. not used in match const wchar_t ageUserName[], // optional. not used in match @@ -589,7 +589,7 @@ typedef void (*FNetCliAuthSendFriendInviteCallback)( void NetCliAuthSendFriendInvite ( const wchar_t emailAddress[], const wchar_t toName[], - const Uuid& inviteUuid, + const plUUID& inviteUuid, FNetCliAuthSendFriendInviteCallback callback, void * param ); diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp index a2d2ef7e..ef0eb673 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp @@ -91,12 +91,12 @@ struct JoinAgeRequestTrans : NetGameTrans { void * m_param; // sent unsigned m_ageMcpId; - Uuid m_accountUuid; + plUUID m_accountUuid; unsigned m_playerInt; JoinAgeRequestTrans ( unsigned ageMcpId, - const Uuid & accountUuid, + const plUUID& accountUuid, unsigned playerInt, FNetCliGameJoinAgeRequestCallback callback, void * param @@ -574,7 +574,7 @@ static NetMsgInitRecv s_recv[] = { //============================================================================ JoinAgeRequestTrans::JoinAgeRequestTrans ( unsigned ageMcpId, - const Uuid & accountUuid, + const plUUID& accountUuid, unsigned playerInt, FNetCliGameJoinAgeRequestCallback callback, void * param @@ -817,7 +817,7 @@ void NetCliGameDisconnect () { //============================================================================ void NetCliGameJoinAgeRequest ( unsigned ageMcpId, - const Uuid & accountUuid, + const plUUID& accountUuid, unsigned playerInt, FNetCliGameJoinAgeRequestCallback callback, void * param diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.h index afca4c95..efce72e5 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.h @@ -78,7 +78,7 @@ typedef void (*FNetCliGameJoinAgeRequestCallback)( ); void NetCliGameJoinAgeRequest ( unsigned ageMcpId, - const Uuid & accountUuid, + const plUUID& accountUuid, unsigned playerInt, FNetCliGameJoinAgeRequestCallback callback, void * param diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp index 5e7ca09d..86c30fa9 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp @@ -91,7 +91,7 @@ struct CliGkConn : AtomicRef { NetCli * cli; char name[MAX_PATH]; plNetAddress addr; - Uuid token; + plUUID token; unsigned seq; unsigned serverChallenge; AsyncCancelId cancelId; @@ -307,7 +307,7 @@ static void CheckedReconnect (CliGkConn * conn, ENetError error) { ReportNetError(kNetProtocolCli2GateKeeper, error); } else { - if (conn->token != kNilGuid) + if (conn->token != kNilUuid) // previously encrypted; reconnect quickly conn->reconnectStartMs = GetNonZeroTimeMs() + 500; else @@ -841,7 +841,7 @@ bool FileSrvIpAddressRequestTrans::Send () { const uintptr_t msg[] = { kCli2GateKeeper_FileSrvIpAddressRequest, m_transId, - m_isPatcher == true ? 1 : 0 + (uintptr_t)(m_isPatcher == true ? 1 : 0) }; m_conn->Send(msg, arrsize(msg)); diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp index 777c7340..c39a3f97 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp @@ -552,7 +552,7 @@ static void ChangedVaultNodeFetched ( //============================================================================ static void VaultNodeChanged ( unsigned nodeId, - const Uuid & revisionId + const plUUID& revisionId ) { LogMsg(kLogDebug, L"Notify: Node changed: %u", nodeId); @@ -2115,7 +2115,7 @@ void VaultFetchNodesAndWait ( //============================================================================ void VaultInitAge ( const plAgeInfoStruct * info, - const Uuid & parentAgeInstId, // optional + const plUUID parentAgeInstId, // optional FVaultInitAgeCallback callback, void * state, void * param @@ -2136,7 +2136,7 @@ void VaultInitAge ( StrToUnicode(ageDesc, info->GetAgeDescription(), arrsize(ageDesc)); NetCliAuthVaultInitAge( - (Uuid)*info->GetAgeInstanceGuid(), + *info->GetAgeInstanceGuid(), parentAgeInstId, ageFilename, ageInstName, @@ -2418,7 +2418,7 @@ bool VaultFindOrCreateChildAgeLinkAndWait (const wchar_t ownedAgeName[], const p } //============================================================================ -bool VaultAddOwnedAgeSpawnPoint (const Uuid & ageInstId, const plSpawnPointInfo & spawnPt) { +bool VaultAddOwnedAgeSpawnPoint (const plUUID& ageInstId, const plSpawnPointInfo & spawnPt) { RelVaultNode * fldr = nil; RelVaultNode * link = nil; @@ -2638,7 +2638,7 @@ bool VaultRegisterOwnedAgeAndWait (const plAgeLinkStruct * link) { VaultInitAge( link->GetAgeInfo(), - kNilGuid, + kNilUuid, _InitAgeCallback, nil, ¶m @@ -2909,7 +2909,7 @@ void VaultRegisterOwnedAge(const plAgeLinkStruct* link) { // Let's go async, my friend :) VaultInitAge(link->GetAgeInfo(), - kNilGuid, + kNilUuid, (FVaultInitAgeCallback)_InitAgeCallback, nil, new plSpawnPointInfo(link->SpawnPoint())); @@ -3012,7 +3012,7 @@ bool VaultRegisterVisitAgeAndWait (const plAgeLinkStruct * link) { VaultInitAge( link->GetAgeInfo(), - kNilGuid, + kNilUuid, _InitAgeCallback, nil, ¶m @@ -3271,7 +3271,7 @@ void VaultRegisterVisitAge(const plAgeLinkStruct* link) { // This doesn't actually *create* a new age but rather fetches the // already existing age vault. Weird? Yes... VaultInitAge(link->GetAgeInfo(), - kNilGuid, + kNilUuid, (FVaultInitAgeCallback)_InitAgeCallback, nil, p @@ -3632,13 +3632,13 @@ bool VaultAmCzarOfCurrentAge () { } //============================================================================ -bool VaultAmOwnerOfAge (const Uuid & ageInstId) { +bool VaultAmOwnerOfAge (const plUUID& ageInstId) { hsAssert(false, "eric, implement me"); return true; } //============================================================================ -bool VaultAmCzarOfAge (const Uuid & ageInstId) { +bool VaultAmCzarOfAge (const plUUID& ageInstId) { // hsAssert(false, "eric, implement me"); return false; } @@ -4249,7 +4249,7 @@ static void _AddChildNodeCallback ( bool VaultAgeFindOrCreateSubAgeLinkAndWait ( const plAgeInfoStruct * info, plAgeLinkStruct * link, - const Uuid & parentAgeInstId + const plUUID& parentAgeInstId ) { if (RelVaultNode * rvnLink = VaultFindAgeSubAgeLinkIncRef(info)) { VaultAgeLinkNode linkAcc(rvnLink); @@ -4464,7 +4464,7 @@ namespace _VaultCreateSubAge { } }; // namespace _VaultCreateSubAge -bool VaultAgeFindOrCreateSubAgeLink(const plAgeInfoStruct* info, plAgeLinkStruct* link, const Uuid& parentUuid) { +bool VaultAgeFindOrCreateSubAgeLink(const plAgeInfoStruct* info, plAgeLinkStruct* link, const plUUID& parentUuid) { using namespace _VaultCreateSubAge; // First, try to find an already existing subage @@ -4633,8 +4633,7 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait ( _InitAgeParam param; memset(¶m, 0, sizeof(param)); - Uuid parentAgeInstId; - memset(&parentAgeInstId, 0, sizeof(parentAgeInstId)); + plUUID parentAgeInstId; if (RelVaultNode * rvnAge = VaultGetAgeNodeIncRef()) { VaultAgeNode access(rvnAge); parentAgeInstId = access.ageInstUuid; diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h index 13e0df9e..c6c6c47a 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h @@ -60,6 +60,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ struct RelVaultNode; +class plUUID; struct VaultCallback { struct IVaultCallback * internal; @@ -316,7 +317,7 @@ typedef void (*FVaultInitAgeCallback)( ); void VaultInitAge ( const class plAgeInfoStruct * info, - const Uuid & parentAgeInstId, + const plUUID parentAgeInstId, FVaultInitAgeCallback callback, void * state, void * param @@ -343,7 +344,7 @@ RelVaultNode * VaultGetPlayerInboxFolderIncRef (); RelVaultNode * VaultGetOwnedAgeLinkIncRef (const plAgeInfoStruct * info); RelVaultNode * VaultGetOwnedAgeInfoIncRef (const plAgeInfoStruct * info); bool VaultGetOwnedAgeLink (const plAgeInfoStruct * info, plAgeLinkStruct * link); -bool VaultAddOwnedAgeSpawnPoint (const Uuid & ageInstId, const plSpawnPointInfo & spawnPt); +bool VaultAddOwnedAgeSpawnPoint (const plUUID& ageInstId, const plSpawnPointInfo & spawnPt); bool VaultSetOwnedAgePublicAndWait (const plAgeInfoStruct * info, bool publicOrNot); RelVaultNode * VaultGetVisitAgeLinkIncRef (const plAgeInfoStruct * info); bool VaultGetVisitAgeLink (const plAgeInfoStruct * info, class plAgeLinkStruct * link); @@ -372,8 +373,8 @@ bool VaultAmInMyPersonalAge (); bool VaultAmInMyNeighborhoodAge (); bool VaultAmOwnerOfCurrentAge (); bool VaultAmCzarOfCurrentAge (); -bool VaultAmOwnerOfAge (const Uuid & ageInstId); -bool VaultAmCzarOfAge (const Uuid & ageInstId); +bool VaultAmOwnerOfAge (const plUUID& ageInstId); +bool VaultAmCzarOfAge (const plUUID& ageInstId); bool VaultRegisterMTStationAndWait ( const wchar_t stationName[], const wchar_t linkBackSpawnPtObjName[] @@ -430,9 +431,9 @@ bool VaultAgeGetSubAgeLink ( bool VaultAgeFindOrCreateSubAgeLinkAndWait ( const plAgeInfoStruct * info, plAgeLinkStruct * link, - const Uuid & parentAgeInstId + const plUUID& parentAgeInstId ); -bool VaultAgeFindOrCreateSubAgeLink(const plAgeInfoStruct* info, plAgeLinkStruct* link, const Uuid& parentUuid); +bool VaultAgeFindOrCreateSubAgeLink(const plAgeInfoStruct* info, plAgeLinkStruct* link, const plUUID& arentUuid); bool VaultAgeFindOrCreateChildAgeLinkAndWait ( const wchar_t parentAgeName[], // nil --> current age, non-nil --> owned age by given name const plAgeInfoStruct * info, diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp index 3596aa56..b3eed74e 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp @@ -132,12 +132,12 @@ void VaultPlayerNode::SetOnlineTime (unsigned v) { } //============================================================================ -void VaultPlayerNode::SetAccountUuid (const Uuid & v) { +void VaultPlayerNode::SetAccountUuid (const plUUID& v) { IVaultNodeSetValue(kAccountUuid, base, &accountUuid, v); } //============================================================================ -void VaultPlayerNode::SetInviteUuid (const Uuid & v) { +void VaultPlayerNode::SetInviteUuid (const plUUID& v) { IVaultNodeSetValue(kInviteUuid, base, &inviteUuid, v); } @@ -181,7 +181,7 @@ void VaultPlayerInfoNode::SetAgeInstName (const wchar_t v[]) { } //============================================================================ -void VaultPlayerInfoNode::SetAgeInstUuid (const Uuid & v) { +void VaultPlayerInfoNode::SetAgeInstUuid (const plUUID& v) { IVaultNodeSetValue(kAgeInstUuid, base, &ageInstUuid, v); } @@ -369,7 +369,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) { break; case kAgeInstGuid: { - plUUID guid = (plUUID)*info.GetAgeInstanceGuid(); + plUUID guid = *info.GetAgeInstanceGuid(); wchar_t src[64]; wcsncpy(src, guid.AsString().ToWchar(), 64); unsigned len = StrLen(src); @@ -464,9 +464,7 @@ bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) { case kAgeInstGuid: { StrTokenize(&str, token, arrsize(token), L"|", 1); if (StrLen(token) > 0) { - Uuid guid; - GuidFromString(token, &guid); - plUUID uuid(guid); + plUUID uuid(plString::FromWchar(token)); info->SetAgeInstanceGuid(&uuid); } } @@ -859,12 +857,12 @@ VaultAgeNode::VaultAgeNode (NetVaultNode * node) } //============================================================================ -void VaultAgeNode::SetAgeInstGuid (const Uuid & v) { +void VaultAgeNode::SetAgeInstGuid (const plUUID& v) { IVaultNodeSetValue(kAgeInstanceGuid, base, &ageInstUuid, v); } //============================================================================ -void VaultAgeNode::SetParentAgeInstGuid (const Uuid & v) { +void VaultAgeNode::SetParentAgeInstGuid (const plUUID& v) { IVaultNodeSetValue(kParentAgeInstanceGuid, base, &parentAgeInstUuid, v); } @@ -914,12 +912,12 @@ void VaultAgeInfoNode::SetAgeUserDefinedName (const wchar_t v[]) { } //============================================================================ -void VaultAgeInfoNode::SetAgeInstGuid (const Uuid & v) { +void VaultAgeInfoNode::SetAgeInstGuid (const plUUID& v) { IVaultNodeSetValue(kAgeInstanceGuid, base, &ageInstUuid, v); } //============================================================================ -void VaultAgeInfoNode::SetParentAgeInstGuid (const Uuid & v) { +void VaultAgeInfoNode::SetParentAgeInstGuid (const plUUID& v) { IVaultNodeSetValue(kParentAgeInstanceGuid, base, &parentAgeInstUuid, v); } @@ -1012,7 +1010,7 @@ void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) { SetAgeSequenceNumber(info->GetAgeSequenceNumber()); // age instance guid - SetAgeInstGuid((Uuid)*info->GetAgeInstanceGuid()); + SetAgeInstGuid(*info->GetAgeInstanceGuid()); // age language SetAgeLanguage(info->GetAgeLanguage()); @@ -1091,6 +1089,6 @@ void VaultMarkerGameNode::SetGameName (const wchar_t v[]) { } //============================================================================ -void VaultMarkerGameNode::SetGameGuid (const Uuid & v) { +void VaultMarkerGameNode::SetGameGuid (const plUUID& v) { IVaultNodeSetValue(kGameGuid, base, &gameGuid, v); } diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h index a2dd1386..fefdd004 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h @@ -101,8 +101,8 @@ struct VaultPlayerNode : NetVaultNodeAccess { wchar_t *& avatarShapeName; int & disabled; unsigned & onlineTime; - Uuid & accountUuid; - Uuid & inviteUuid; + plUUID& accountUuid; + plUUID& inviteUuid; int & explorer; VaultPlayerNode (NetVaultNode * node); @@ -114,8 +114,8 @@ struct VaultPlayerNode : NetVaultNodeAccess { void SetAvatarShapeName (const wchar_t v[]); void SetDisabled (int v); void SetOnlineTime (unsigned v); - void SetAccountUuid (const Uuid & v); - void SetInviteUuid (const Uuid & v); + void SetAccountUuid (const plUUID& v); + void SetInviteUuid (const plUUID& v); void SetExplorer (int v); }; @@ -136,7 +136,7 @@ struct VaultPlayerInfoNode : NetVaultNodeAccess { unsigned & playerId; wchar_t *& playerName; wchar_t *& ageInstName; - Uuid & ageInstUuid; + plUUID& ageInstUuid; int & online; int & ccrLevel; @@ -148,7 +148,7 @@ struct VaultPlayerInfoNode : NetVaultNodeAccess { void SetPlayerId (unsigned v); void SetPlayerName (const wchar_t v[]); void SetAgeInstName (const wchar_t v[]); - void SetAgeInstUuid (const Uuid & v); + void SetAgeInstUuid (const plUUID& v); void SetOnline (int v); void SetCCRLevel (int v); }; @@ -362,16 +362,16 @@ struct VaultAgeNode : NetVaultNodeAccess { static const uint64_t kParentAgeInstanceGuid = NetVaultNode::kUuid_2; static const uint64_t kAgeName = NetVaultNode::kString64_1; - Uuid & ageInstUuid; - Uuid & parentAgeInstUuid; + plUUID& ageInstUuid; + plUUID& parentAgeInstUuid; wchar_t *& ageName; VaultAgeNode (NetVaultNode * node); VaultAgeNode (const VaultAgeNode &); // not implemented const VaultAgeNode & operator= (const VaultAgeNode &); // not implemented - void SetAgeInstGuid (const Uuid & v); - void SetParentAgeInstGuid (const Uuid & v); + void SetAgeInstGuid (const plUUID& v); + void SetParentAgeInstGuid (const plUUID& v); void SetAgeName (const wchar_t v[]); }; @@ -396,8 +396,8 @@ struct VaultAgeInfoNode : NetVaultNodeAccess { wchar_t *& ageFilename; wchar_t *& ageInstName; wchar_t *& ageUserDefinedName; - Uuid & ageInstUuid; - Uuid & parentAgeInstUuid; + plUUID& ageInstUuid; + plUUID& parentAgeInstUuid; int & ageSequenceNumber; int & ageIsPublic; int & ageLanguage; @@ -413,8 +413,8 @@ struct VaultAgeInfoNode : NetVaultNodeAccess { void SetAgeFilename (const wchar_t v[]); void SetAgeInstName (const wchar_t v[]); void SetAgeUserDefinedName (const wchar_t v[]); - void SetAgeInstGuid (const Uuid & v); - void SetParentAgeInstGuid (const Uuid & v); + void SetAgeInstGuid (const plUUID& v); + void SetParentAgeInstGuid (const plUUID& v); void SetAgeSequenceNumber (int v); void _SetAgeIsPublic (int v); // WARNING: Do not call this. The age will not be set public this way. Use NetCliAuthSetAgePublic instead (changes this field's value in the process). void SetAgeLanguage (int v); @@ -456,12 +456,12 @@ struct VaultMarkerGameNode : NetVaultNodeAccess { static const uint64_t kGameGuid = NetVaultNode::kUuid_1; wchar_t *& gameName; - Uuid & gameGuid; + plUUID& gameGuid; VaultMarkerGameNode (NetVaultNode * node); VaultMarkerGameNode (const VaultMarkerGameNode &); // not implemented const VaultMarkerGameNode & operator= (const VaultMarkerGameNode &); // not implemented void SetGameName (const wchar_t v[]); - void SetGameGuid (const Uuid & v); + void SetGameGuid (const plUUID& v); }; From f455ee25ecd3e92ca85ca333516aeeeedf4a807a Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Fri, 4 Jan 2013 21:54:22 -0800 Subject: [PATCH 6/8] Fixes for UUID compilation on Windows. --- Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h | 1 + .../NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp | 2 +- Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp | 2 +- .../PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h index 0a81b6cc..4724c7ce 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h @@ -49,6 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // PURPOSE: Class wrapper for game manager messages // +#include "HeadSpin.h" #include "../pyGlueHelpers.h" #include diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp index 91490b37..429f78b2 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp @@ -489,7 +489,7 @@ static void SocketInitListen ( notify.buildId = 0; notify.buildType = 0; notify.branchId = 0; - notify.productId = 0; + notify.productId = kNilUuid; notify.addr = listenAddr; notify.buffer = sock->opRead.read.buffer; notify.bytes = 0; diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp index eb94d2a9..294c774c 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp @@ -428,6 +428,6 @@ FAsyncNotifySocketProc AsyncSocketFindNotifyProc ( *buildId = 0; *buildType = 0; *branchId = 0; - *productId = 0; + *productId = kNilUuid; return nil; } diff --git a/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp b/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp index dc43052d..94b7f2cd 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp @@ -39,6 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ +#include "hsWindows.h" #include "plNetClientRecorder.h" #include "hsStream.h" #include "hsTimer.h" From 6681b1d596efa0b0f109fcd16dbf4efdadaf8ee6 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Fri, 4 Jan 2013 22:30:46 -0800 Subject: [PATCH 7/8] Fix a cast error and check UUID size. --- .../Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp | 2 +- Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp | 2 ++ Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp | 3 +++ Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp | 5 +++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp index 51ffd96e..fa3a7d9a 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp @@ -977,7 +977,7 @@ void NetVaultNodeFieldArray::GetFieldValueString_LCS ( case NetVaultNode::kUuid_2: case NetVaultNode::kUuid_3: case NetVaultNode::kUuid_4: { - plString tmp = plUUID((char*)fieldAddr).AsString(); + plString tmp = reinterpret_cast(fieldAddr)->AsString(); StrPrintf(dst, dstChars, L"hextoraw('%s')", tmp.c_str()); } diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp index 05bbc5ca..8ba9be82 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp @@ -42,6 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnUUID.h" #include "hsStream.h" +static_assert(sizeof(plUUID) == sizeof(uint8_t[16]), "plUUID Must be the same size as a UUID"); + const plUUID kNilUuid; plUUID::plUUID() diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp index 2154bfa1..2b1a5a41 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp @@ -45,6 +45,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include +// Check UUID size +static_assert(sizeof(plUUID) == sizeof(uuid_t), "plUUID and uuid_t types differ in size"); + struct plUUIDHelper { static inline void CopyToPlasma( plUUID * dst, const uuid_t & src ) diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp index 7eb4fbd9..aaf86253 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp @@ -43,10 +43,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifdef HS_BUILD_FOR_WIN32 - - #include +// Check UUID size +static_assert(sizeof(plUUID) == sizeof(GUID), "plUUID and Win32 GUID types differ in size"); + void plUUID::Clear() { UuidCreateNil( (GUID *)this ); From a8126757f8cdae81f59876efb891d21534d2c2d0 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 5 Jan 2013 14:08:08 -0800 Subject: [PATCH 8/8] Fixes pointed out by @zrax and @hoikas. --- Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp | 3 ++- Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h | 2 +- Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp | 1 + Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp | 4 ++-- Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp | 2 +- Sources/Plasma/FeatureLib/pfPython/pyNotify.h | 2 +- Sources/Plasma/FeatureLib/pfPython/pyNotifyGlue.cpp | 4 ++-- Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp | 2 +- Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp | 2 +- Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp | 2 +- Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp | 2 +- Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h | 2 +- Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp | 1 - 13 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp index a1d9533d..26c53632 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp @@ -47,6 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyGameCli.h" #include "pfGameMgr/pfGameMgr.h" +#include "pnUUID/pnUUID.h" #include "TicTacToe/pyTTTGame.h" #include "Heek/pyHeekGame.h" @@ -104,7 +105,7 @@ plUUID pyGameCli::GameTypeID() const { if (gameClient) { - return plUUID(gameClient->GetGameTypeId()); + return gameClient->GetGameTypeId(); } return kNilUuid; } diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h index db9dad4e..128f1adc 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h @@ -52,10 +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 plUUID; class pyGameCli { diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp index c0d3b37d..e6707216 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp @@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "../pyKey.h" #pragma hdrstop +#include "pnUUID/pnUUID.h" #include "pyGameCli.h" #include "../pyEnum.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp index 07f91329..87e41dd8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp @@ -109,7 +109,7 @@ plUUID pyGameMgrInviteReceivedMsg::GameTypeID() const if (message) { const Srv2Cli_GameMgr_InviteReceived* gmMsg = (const Srv2Cli_GameMgr_InviteReceived*)message->netMsg; - return plUUID(gmMsg->gameTypeId); + return gmMsg->gameTypeId; } return kNilUuid; } @@ -148,7 +148,7 @@ plUUID pyGameMgrInviteRevokedMsg::GameTypeID() const if (message) { const Srv2Cli_GameMgr_InviteRevoked* gmMsg = (const Srv2Cli_GameMgr_InviteRevoked*)message->netMsg; - return plUUID(gmMsg->gameTypeId); + return gmMsg->gameTypeId; } return kNilUuid; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp index b435ebf7..8cab9ab0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp @@ -141,7 +141,7 @@ void pyNotify::AddVarNumber(const char* name, float number) fBuildMsg.AddVariableEvent(name, number); } -void pyNotify::AddVarNumber(const char* name, int number) +void pyNotify::AddVarNumber(const char* name, int32_t number) { fBuildMsg.AddVariableEvent(name, number); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNotify.h b/Sources/Plasma/FeatureLib/pfPython/pyNotify.h index c2179a2d..81f71eea 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNotify.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyNotify.h @@ -97,7 +97,7 @@ public: virtual void AddPickEvent(bool enabled, pyKey* other, pyKey* self, pyPoint3 hitPoint); virtual void AddControlKeyEvent( int32_t key, bool down ); virtual void AddVarNumber(const char* name, float number); - virtual void AddVarNumber(const char* name, int number); + virtual void AddVarNumber(const char* name, int32_t number); virtual void AddVarNull(const char* name); virtual void AddVarKey(const char* name, pyKey* key); virtual void AddFacingEvent( bool enabled, pyKey* other, pyKey* self, float dot); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNotifyGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNotifyGlue.cpp index e23e931f..5e965361 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, (int)PyInt_AsLong(number)); + self->fThis->AddVarNumber(name, static_cast(PyInt_AsLong(number))); else if (PyLong_Check(number)) { // try as int first long i = PyLong_AsLong(number); if (!PyErr_Occurred()) { - self->fThis->AddVarNumber(name, (int)i); + self->fThis->AddVarNumber(name, static_cast(i)); } else { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp index 2901d681..655d6ae0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp @@ -93,7 +93,7 @@ plUUID pyVaultMarkerGameNode::GetGameGuid() const { if (fNode) { VaultMarkerGameNode access(fNode); - return plUUID(access.gameGuid); + return access.gameGuid; } return kNilUuid; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp index baeee32e..bc22584c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp @@ -325,7 +325,7 @@ const char * pyVaultNode::GetCreateAgeName( void ) plUUID pyVaultNode::GetCreateAgeGuid(void) const { if (fNode) { - return plUUID(fNode->createAgeUuid); + return fNode->createAgeUuid; } return kNilUuid; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp index 15547e56..d93e87c0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp @@ -162,7 +162,7 @@ plUUID pyVaultPlayerInfoNode::Player_GetAgeGuid(void) const { if (fNode) { VaultPlayerInfoNode playerInfo(fNode); - return plUUID(playerInfo.ageInstUuid); + return playerInfo.ageInstUuid; } return kNilUuid; } diff --git a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp index f29bb387..9c829a7d 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp @@ -607,7 +607,7 @@ void plNotifyMsg::AddVariableEvent( const char* name, float number ) // // PURPOSE : Add a variable event record to this notify message // -void plNotifyMsg::AddVariableEvent( const char* name, int number ) +void plNotifyMsg::AddVariableEvent( const char* name, int32_t number ) { // create the control key event record proVariableEventData* pED = new proVariableEventData; diff --git a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h index 2b233db8..114d3f76 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h @@ -376,7 +376,7 @@ public: void AddPickEvent( const plKey &other, const plKey& self, bool enabled, hsPoint3 hitPoint ); void AddControlKeyEvent( int32_t key, bool down ); void AddVariableEvent( const char* name, float number ); - void AddVariableEvent( const char* name, int number ); + void AddVariableEvent( const char* name, int32_t number ); void AddVariableEvent( const char* name ); void AddVariableEvent( const char *name, const plKey &key ); void AddFacingEvent( const plKey &other, const plKey &self, float dot, bool enabled); diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp index 2b1a5a41..565fbc51 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp @@ -67,7 +67,6 @@ struct plUUIDHelper void plUUID::Clear() { uuid_t g; - //plUUIDHelper::CopyToNative( g, this ); uuid_clear( g ); plUUIDHelper::CopyToPlasma( this, g ); }