Browse Source

Merge pull request #248 from dpogue/uuid-fixes

Replace pnUtUuid with plUUID.
Adam Johnson 12 years ago
parent
commit
b574a583f4
  1. 4
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp
  2. 4
      Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp
  3. 4
      Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.h
  4. 4
      Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.cpp
  5. 2
      Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.h
  6. 23
      Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGameGlue.cpp
  7. 4
      Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.cpp
  8. 2
      Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.h
  9. 23
      Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGameGlue.cpp
  10. 4
      Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.cpp
  11. 2
      Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.h
  12. 23
      Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGameGlue.cpp
  13. 4
      Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.cpp
  14. 2
      Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.h
  15. 23
      Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp
  16. 4
      Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.cpp
  17. 2
      Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.h
  18. 23
      Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGameGlue.cpp
  19. 4
      Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.cpp
  20. 2
      Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.h
  21. 23
      Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGameGlue.cpp
  22. 14
      Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp
  23. 6
      Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h
  24. 30
      Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp
  25. 3
      Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliMsg.cpp
  26. 25
      Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp
  27. 14
      Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h
  28. 7
      Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsgGlue.cpp
  29. 14
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  30. 6
      Sources/Plasma/FeatureLib/pfPython/cyMisc.h
  31. 7
      Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp
  32. 3
      Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp
  33. 2
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
  34. 2
      Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp
  35. 2
      Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp
  36. 2
      Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp
  37. 1
      Sources/Plasma/FeatureLib/pfPython/pyGUIControlDraggable.cpp
  38. 1
      Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.cpp
  39. 1
      Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp
  40. 2
      Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp
  41. 2
      Sources/Plasma/FeatureLib/pfPython/pyNotify.h
  42. 4
      Sources/Plasma/FeatureLib/pfPython/pyNotifyGlue.cpp
  43. 10
      Sources/Plasma/FeatureLib/pfPython/pyVault.cpp
  44. 10
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp
  45. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h
  46. 3
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNodeGlue.cpp
  47. 2
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.h
  48. 3
      Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp
  49. 12
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp
  50. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h
  51. 3
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNodeGlue.cpp
  52. 27
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp
  53. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h
  54. 3
      Sources/Plasma/FeatureLib/pfPython/pyVaultNodeGlue.cpp
  55. 2
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp
  56. 15
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp
  57. 5
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h
  58. 3
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp
  59. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp
  60. 11
      Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h
  61. 2
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp
  62. 18
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp
  63. 2
      Sources/Plasma/NucleusLib/pnGameMgr/BlueSpiral/pnGmBlueSpiral.h
  64. 2
      Sources/Plasma/NucleusLib/pnGameMgr/ClimbingWall/pnGmClimbingWall.h
  65. 2
      Sources/Plasma/NucleusLib/pnGameMgr/Heek/pnGmHeek.h
  66. 2
      Sources/Plasma/NucleusLib/pnGameMgr/Marker/pnGmMarker.h
  67. 1
      Sources/Plasma/NucleusLib/pnGameMgr/Pch.h
  68. 2
      Sources/Plasma/NucleusLib/pnGameMgr/TicTacToe/pnGmTicTacToe.h
  69. 2
      Sources/Plasma/NucleusLib/pnGameMgr/VarSync/pnGmVarSync.h
  70. 10
      Sources/Plasma/NucleusLib/pnGameMgr/pnGameMgr.h
  71. 2
      Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp
  72. 2
      Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h
  73. 4
      Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp
  74. 22
      Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.cpp
  75. 1
      Sources/Plasma/NucleusLib/pnNetProtocol/Pch.h
  76. 30
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.h
  77. 6
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h
  78. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h
  79. 42
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.h
  80. 30
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h
  81. 6
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h
  82. 60
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h
  83. 31
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp
  84. 44
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h
  85. 6
      Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt
  86. 25
      Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp
  87. 14
      Sources/Plasma/NucleusLib/pnUUID/pnUUID.h
  88. 21
      Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp
  89. 5
      Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp
  90. 4
      Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt
  91. 69
      Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp
  92. 186
      Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp
  93. 1
      Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h
  94. 106
      Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp
  95. 118
      Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h
  96. 4
      Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp
  97. 14
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp
  98. 29
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp
  99. 14
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h
  100. 1
      Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

4
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp

@ -810,7 +810,7 @@ PF_CONSOLE_CMD( Net_Vault,
plAgeLinkStruct link; plAgeLinkStruct link;
link.GetAgeInfo()->SetAgeFilename( params[0] ); link.GetAgeInfo()->SetAgeFilename( params[0] );
link.GetAgeInfo()->SetAgeInstanceName( params[0] ); link.GetAgeInfo()->SetAgeInstanceName( params[0] );
plUUID guid(GuidGenerate()); plUUID guid = plUUID::Generate();
link.GetAgeInfo()->SetAgeInstanceGuid( &guid); link.GetAgeInfo()->SetAgeInstanceGuid( &guid);
link.SetSpawnPoint( kDefaultSpawnPoint ); link.SetSpawnPoint( kDefaultSpawnPoint );
bool success = VaultRegisterOwnedAgeAndWait(&link); bool success = VaultRegisterOwnedAgeAndWait(&link);
@ -838,7 +838,7 @@ PF_CONSOLE_CMD( Net_Vault,
plAgeLinkStruct link; plAgeLinkStruct link;
link.GetAgeInfo()->SetAgeFilename( params[0] ); link.GetAgeInfo()->SetAgeFilename( params[0] );
link.GetAgeInfo()->SetAgeInstanceName( params[0] ); link.GetAgeInfo()->SetAgeInstanceName( params[0] );
plUUID guid(GuidGenerate()); plUUID guid = plUUID::Generate();
link.GetAgeInfo()->SetAgeInstanceGuid( &guid); link.GetAgeInfo()->SetAgeInstanceGuid( &guid);
link.SetSpawnPoint( kDefaultSpawnPoint ); link.SetSpawnPoint( kDefaultSpawnPoint );
bool success = VaultRegisterOwnedAgeAndWait(&link); bool success = VaultRegisterOwnedAgeAndWait(&link);

4
Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp

@ -409,7 +409,7 @@ void pfGameMgr::JoinGame (
//============================================================================ //============================================================================
void pfGameMgr::CreateGame ( void pfGameMgr::CreateGame (
plKey receiver, plKey receiver,
const Uuid & gameTypeId, const plUUID& gameTypeId,
unsigned createOptions, unsigned createOptions,
unsigned initBytes, unsigned initBytes,
const void * initData const void * initData
@ -439,7 +439,7 @@ void pfGameMgr::CreateGame (
//============================================================================ //============================================================================
void pfGameMgr::JoinCommonGame ( void pfGameMgr::JoinCommonGame (
plKey receiver, plKey receiver,
const Uuid & gameTypeId, const plUUID& gameTypeId,
unsigned gameNumber, unsigned gameNumber,
unsigned initBytes, unsigned initBytes,
const void * initData const void * initData

4
Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.h

@ -170,7 +170,7 @@ public:
// Create a new game // Create a new game
void CreateGame ( void CreateGame (
plKey receiver, // Receiver of pfGameCliMsgs for this game 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 createOptions, // Game create options from pnGameMgr.h
unsigned initBytes, // Game-specific initialization data unsigned initBytes, // Game-specific initialization data
const void * initData const void * initData
@ -178,7 +178,7 @@ public:
// Join or create the specified common game // Join or create the specified common game
void JoinCommonGame ( void JoinCommonGame (
plKey receiver, // Receiver of pfGameCliMsgs for this game 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 unsigned gameNumber, // "table number" of common game to create/join
// In case the common game needs to // In case the common game needs to
// be created on the server, these // be created on the server, these

4
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 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; return gameUuid == kGameTypeId_BlueSpiral;
} }

2
Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGame.h

@ -68,7 +68,7 @@ public:
static void AddPlasmaClasses(PyObject* m); static void AddPlasmaClasses(PyObject* m);
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods); static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
static bool IsBlueSpiralGame(std::wstring guid); static bool IsBlueSpiralGame(plString& guid);
static void JoinCommonBlueSpiralGame(pyKey& callbackKey, unsigned gameID); static void JoinCommonBlueSpiralGame(pyKey& callbackKey, unsigned gameID);
void StartGame(); void StartGame();

23
Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGameGlue.cpp

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsBlueSpiralGame, args, "Params: typeID\nRetur
PyObject* textObj; PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &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; PYTHON_RETURN_ERROR;
} }
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{ {
int strLen = PyUnicode_GetSize(textObj); plString text = PyString_AsStringEx(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
bool retVal = pyBlueSpiralGame::IsBlueSpiralGame(text); 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); PYTHON_RETURN_BOOL(retVal);
} }
else else
{ {
PyErr_SetString(PyExc_TypeError, "PtIsBlueSpiralGame expects a unicode string"); PyErr_SetString(PyExc_TypeError, "PtIsBlueSpiralGame expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
} }

4
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 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; return gameUuid == kGameTypeId_ClimbingWall;
} }

2
Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGame.h

@ -69,7 +69,7 @@ public:
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods); static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
static void AddPlasmaConstantsClasses(PyObject* m); static void AddPlasmaConstantsClasses(PyObject* m);
static bool IsClimbingWallGame(std::wstring guid); static bool IsClimbingWallGame(plString& guid);
static void JoinCommonClimbingWallGame(pyKey& callbackKey, unsigned gameID); static void JoinCommonClimbingWallGame(pyKey& callbackKey, unsigned gameID);
void ChangeNumBlockers(int amountToAdjust); void ChangeNumBlockers(int amountToAdjust);

23
Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGameGlue.cpp

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsClimbingWallGame, args, "Params: typeID\nRet
PyObject* textObj; PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &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; PYTHON_RETURN_ERROR;
} }
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{ {
int strLen = PyUnicode_GetSize(textObj); plString text = PyString_AsStringEx(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
bool retVal = pyClimbingWallGame::IsClimbingWallGame(text); 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); PYTHON_RETURN_BOOL(retVal);
} }
else else
{ {
PyErr_SetString(PyExc_TypeError, "PtIsClimbingWallGame expects a unicode string"); PyErr_SetString(PyExc_TypeError, "PtIsClimbingWallGame expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
} }

4
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 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; return gameUuid == kGameTypeId_Heek;
} }

2
Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.h

@ -69,7 +69,7 @@ public:
static void AddPlasmaConstantsClasses(PyObject* m); static void AddPlasmaConstantsClasses(PyObject* m);
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods); static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
static bool IsHeekGame(std::wstring guid); static bool IsHeekGame(plString& guid);
static void JoinCommonHeekGame(pyKey& callbackKey, unsigned gameID); static void JoinCommonHeekGame(pyKey& callbackKey, unsigned gameID);
void PlayGame(int position, uint32_t points, std::wstring name); void PlayGame(int position, uint32_t points, std::wstring name);

23
Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGameGlue.cpp

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsHeekGame, args, "Params: typeID\nReturns tru
PyObject* textObj; PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &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; PYTHON_RETURN_ERROR;
} }
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{ {
int strLen = PyUnicode_GetSize(textObj); plString text = PyString_AsStringEx(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
bool retVal = pyHeekGame::IsHeekGame(text); 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); PYTHON_RETURN_BOOL(retVal);
} }
else else
{ {
PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a unicode string"); PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
} }

4
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 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; return gameUuid == kGameTypeId_Marker;
} }

2
Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGame.h

@ -69,7 +69,7 @@ public:
static void AddPlasmaConstantsClasses(PyObject* m); static void AddPlasmaConstantsClasses(PyObject* m);
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods); static void AddPlasmaMethods(std::vector<PyMethodDef>& 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); static void CreateMarkerGame(pyKey& callbackKey, unsigned gameType, std::wstring gameName, unsigned long timeLimit, std::wstring templateId);
void StartGame(); void StartGame();

23
Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsMarkerGame, args, "Params: typeID\nReturns t
PyObject* textObj; PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &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; PYTHON_RETURN_ERROR;
} }
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{ {
int strLen = PyUnicode_GetSize(textObj); plString text = PyString_AsStringEx(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
bool retVal = pyMarkerGame::IsMarkerGame(text); 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); PYTHON_RETURN_BOOL(retVal);
} }
else else
{ {
PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a unicode string"); PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
} }

4
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 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; return gameUuid == kGameTypeId_TicTacToe;
} }

2
Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGame.h

@ -69,7 +69,7 @@ public:
static void AddPlasmaConstantsClasses(PyObject* m); static void AddPlasmaConstantsClasses(PyObject* m);
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods); static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
static bool IsTTTGame(std::wstring guid); static bool IsTTTGame(plString& guid);
static void CreateTTTGame(pyKey& callbackKey, unsigned numPlayers); static void CreateTTTGame(pyKey& callbackKey, unsigned numPlayers);
static void JoinCommonTTTGame(pyKey& callbackKey, unsigned gameID, unsigned numPlayers); static void JoinCommonTTTGame(pyKey& callbackKey, unsigned gameID, unsigned numPlayers);

23
Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGameGlue.cpp

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsTTTGame, args, "Params: typeID\nReturns true
PyObject* textObj; PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &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; PYTHON_RETURN_ERROR;
} }
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{ {
int strLen = PyUnicode_GetSize(textObj); plString text = PyString_AsStringEx(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
bool retVal = pyTTTGame::IsTTTGame(text); 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); PYTHON_RETURN_BOOL(retVal);
} }
else else
{ {
PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a unicode string"); PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
} }

4
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 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; return gameUuid == kGameTypeId_VarSync;
} }

2
Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGame.h

@ -68,7 +68,7 @@ public:
static void AddPlasmaClasses(PyObject* m); static void AddPlasmaClasses(PyObject* m);
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods); static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
static bool IsVarSyncGame(std::wstring guid); static bool IsVarSyncGame(plString& guid);
static void JoinCommonVarSyncGame(pyKey& callbackKey); static void JoinCommonVarSyncGame(pyKey& callbackKey);
void SetStringVar(unsigned long id, std::wstring val); void SetStringVar(unsigned long id, std::wstring val);

23
Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGameGlue.cpp

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsVarSyncGame, args, "Params: typeID\nReturns
PyObject* textObj; PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &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; PYTHON_RETURN_ERROR;
} }
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{ {
int strLen = PyUnicode_GetSize(textObj); plString text = PyString_AsStringEx(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
bool retVal = pyVarSyncGame::IsVarSyncGame(text); 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); PYTHON_RETURN_BOOL(retVal);
} }
else else
{ {
PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a unicode string"); PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
} }

14
Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp

@ -42,10 +42,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <Python.h> #include <Python.h>
#include "../pyKey.h" #include "../pyKey.h"
#include "plString.h"
#pragma hdrstop #pragma hdrstop
#include "pyGameCli.h" #include "pyGameCli.h"
#include "pfGameMgr/pfGameMgr.h" #include "pfGameMgr/pfGameMgr.h"
#include "pnUUID/pnUUID.h"
#include "TicTacToe/pyTTTGame.h" #include "TicTacToe/pyTTTGame.h"
#include "Heek/pyHeekGame.h" #include "Heek/pyHeekGame.h"
@ -81,9 +83,9 @@ PyObject* pyGameCli::GetGameCli(unsigned gameID)
PYTHON_RETURN_NONE; 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); return pfGameMgr::GetInstance()->GetGameNameByTypeId(gameUuid);
} }
@ -99,15 +101,13 @@ unsigned pyGameCli::GameID() const
return 0; return 0;
} }
std::wstring pyGameCli::GameTypeID() const plUUID pyGameCli::GameTypeID() const
{ {
if (gameClient) if (gameClient)
{ {
wchar_t guidStr[256]; return gameClient->GetGameTypeId();
GuidToString(gameClient->GetGameTypeId(), guidStr, arrsize(guidStr));
return guidStr;
} }
return L""; return kNilUuid;
} }
std::wstring pyGameCli::Name() const std::wstring pyGameCli::Name() const

6
Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.h

@ -54,6 +54,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <vector> #include <vector>
class pfGameCli; class pfGameCli;
class plString;
class plUUID;
class pyGameCli class pyGameCli
{ {
@ -76,11 +78,11 @@ public:
static std::vector<unsigned> GetGameIDs(); static std::vector<unsigned> GetGameIDs();
static PyObject* GetGameCli(unsigned gameID); // returns a ptGameCli 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); static void JoinGame(pyKey& callbackKey, unsigned gameID);
unsigned GameID() const; unsigned GameID() const;
std::wstring GameTypeID() const; plUUID GameTypeID() const;
std::wstring Name() const; std::wstring Name() const;
unsigned PlayerCount() const; unsigned PlayerCount() const;

30
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" #include "../pyKey.h"
#pragma hdrstop #pragma hdrstop
#include "pnUUID/pnUUID.h"
#include "pyGameCli.h" #include "pyGameCli.h"
#include "../pyEnum.h" #include "../pyEnum.h"
@ -84,31 +85,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetGameNameByTypeID, args, "Params: guid\nRetu
PyObject* textObj; PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &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; 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';
std::wstring retVal = pyGameCli::GetGameNameByTypeID(text);
delete [] text;
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
}
else if (PyString_Check(textObj))
{ {
// we'll allow this, just in case something goes weird plString guid = PyString_AsStringEx(textObj);
char* text = PyString_AsString(textObj);
wchar_t* wText = hsStringToWString(text); std::wstring retVal = pyGameCli::GetGameNameByTypeID(guid);
std::wstring retVal = pyGameCli::GetGameNameByTypeID(wText);
delete [] wText;
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length()); return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
} }
else else
{ {
PyErr_SetString(PyExc_TypeError, "PtGetGameNameByTypeID expects a unicode string"); PyErr_SetString(PyExc_TypeError, "PtGetGameNameByTypeID expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
} }
@ -139,8 +129,8 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptGameCli, gameID)
PYTHON_METHOD_DEFINITION_NOARGS(ptGameCli, gameTypeID) PYTHON_METHOD_DEFINITION_NOARGS(ptGameCli, gameTypeID)
{ {
std::wstring retVal = self->fThis->GameTypeID(); plUUID retVal = self->fThis->GameTypeID();
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length()); return PyString_FromPlString(retVal.AsString());
} }
PYTHON_METHOD_DEFINITION_NOARGS(ptGameCli, name) PYTHON_METHOD_DEFINITION_NOARGS(ptGameCli, name)

3
Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliMsg.cpp

@ -129,7 +129,8 @@ PyObject* pyGameCliMsg::UpcastToGameMsg() const
if (!message) if (!message)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
const Uuid& gameTypeId = message->gameCli->GetGameTypeId(); const plUUID& gameTypeId = message->gameCli->GetGameTypeId();
if (gameTypeId == kGameTypeId_TicTacToe) if (gameTypeId == kGameTypeId_TicTacToe)
return pyTTTMsg::New(message); return pyTTTMsg::New(message);
else if (gameTypeId == kGameTypeId_Heek) else if (gameTypeId == kGameTypeId_Heek)

25
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 "pyGameMgrMsg.h"
#include "pfGameMgr/pfGameMgr.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 message = nil; // wrong type, just clear it out
} }
unsigned long pyGameMgrInviteReceivedMsg::InviterID() const uint32_t pyGameMgrInviteReceivedMsg::InviterID() const
{ {
if (message) if (message)
{ {
@ -103,19 +104,17 @@ unsigned long pyGameMgrInviteReceivedMsg::InviterID() const
return 0; return 0;
} }
std::wstring pyGameMgrInviteReceivedMsg::GameTypeID() const plUUID pyGameMgrInviteReceivedMsg::GameTypeID() const
{ {
if (message) if (message)
{ {
const Srv2Cli_GameMgr_InviteReceived* gmMsg = (const Srv2Cli_GameMgr_InviteReceived*)message->netMsg; const Srv2Cli_GameMgr_InviteReceived* gmMsg = (const Srv2Cli_GameMgr_InviteReceived*)message->netMsg;
wchar_t buffer[256]; return gmMsg->gameTypeId;
GuidToString(gmMsg->gameTypeId, buffer, arrsize(buffer));
return buffer;
} }
return L""; return kNilUuid;
} }
unsigned long pyGameMgrInviteReceivedMsg::NewGameID() const uint32_t pyGameMgrInviteReceivedMsg::NewGameID() const
{ {
if (message) if (message)
{ {
@ -134,7 +133,7 @@ pyGameMgrInviteRevokedMsg::pyGameMgrInviteRevokedMsg(pfGameMgrMsg* msg): pyGameM
message = nil; // wrong type, just clear it out message = nil; // wrong type, just clear it out
} }
unsigned long pyGameMgrInviteRevokedMsg::InviterID() const uint32_t pyGameMgrInviteRevokedMsg::InviterID() const
{ {
if (message) if (message)
{ {
@ -144,19 +143,17 @@ unsigned long pyGameMgrInviteRevokedMsg::InviterID() const
return 0; return 0;
} }
std::wstring pyGameMgrInviteRevokedMsg::GameTypeID() const plUUID pyGameMgrInviteRevokedMsg::GameTypeID() const
{ {
if (message) if (message)
{ {
const Srv2Cli_GameMgr_InviteRevoked* gmMsg = (const Srv2Cli_GameMgr_InviteRevoked*)message->netMsg; const Srv2Cli_GameMgr_InviteRevoked* gmMsg = (const Srv2Cli_GameMgr_InviteRevoked*)message->netMsg;
wchar_t buffer[256]; return gmMsg->gameTypeId;
GuidToString(gmMsg->gameTypeId, buffer, arrsize(buffer));
return buffer;
} }
return L""; return kNilUuid;
} }
unsigned long pyGameMgrInviteRevokedMsg::NewGameID() const uint32_t pyGameMgrInviteRevokedMsg::NewGameID() const
{ {
if (message) if (message)
{ {

14
Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.h

@ -49,10 +49,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// PURPOSE: Class wrapper for game manager messages // PURPOSE: Class wrapper for game manager messages
// //
#include "HeadSpin.h"
#include "../pyGlueHelpers.h" #include "../pyGlueHelpers.h"
#include <string> #include <string>
class pfGameMgrMsg; class pfGameMgrMsg;
class plUUID;
class pyGameMgrMsg class pyGameMgrMsg
{ {
@ -95,9 +97,9 @@ public:
static void AddPlasmaClasses(PyObject* m); static void AddPlasmaClasses(PyObject* m);
unsigned long InviterID() const; uint32_t InviterID() const;
std::wstring GameTypeID() const; plUUID GameTypeID() const;
unsigned long NewGameID() const; uint32_t NewGameID() const;
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -116,9 +118,9 @@ public:
static void AddPlasmaClasses(PyObject* m); static void AddPlasmaClasses(PyObject* m);
unsigned long InviterID() const; uint32_t InviterID() const;
std::wstring GameTypeID() const; plUUID GameTypeID() const;
unsigned long NewGameID() const; uint32_t NewGameID() const;
}; };
#endif // pyGameMgrMsg_h #endif // pyGameMgrMsg_h

7
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 "pyGameMgrMsg.h"
#include "pfGameMgr/pfGameMgr.h" #include "pfGameMgr/pfGameMgr.h"
#include "pnUUID/pnUUID.h"
#include "../pyEnum.h" #include "../pyEnum.h"
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -130,8 +131,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteReceivedMsg, inviterID)
PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteReceivedMsg, gameTypeID) PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteReceivedMsg, gameTypeID)
{ {
std::wstring retVal = self->fThis->GameTypeID(); return PyString_FromString(self->fThis->GameTypeID().AsString().c_str());
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
} }
PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteReceivedMsg, newGameID) PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteReceivedMsg, newGameID)
@ -183,8 +183,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteRevokedMsg, inviterID)
PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteRevokedMsg, gameTypeID) PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteRevokedMsg, gameTypeID)
{ {
std::wstring retVal = self->fThis->GameTypeID(); return PyString_FromString(self->fThis->GameTypeID().AsString().c_str());
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
} }
PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteRevokedMsg, newGameID) PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteRevokedMsg, newGameID)

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

@ -1689,7 +1689,7 @@ void cyMisc::SetShareSpawnPoint(const char* spawnPoint)
pMsg->Send(); pMsg->Send();
} }
void cyMisc::SetShareAgeInstanceGuid(const Uuid& guid) void cyMisc::SetShareAgeInstanceGuid(const plUUID& guid)
{ {
plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kSetShareAgeInstanceGuid); plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kSetShareAgeInstanceGuid);
plKey k = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); plKey k = plNetClientMgr::GetInstance()->GetLocalPlayerKey();
@ -2828,12 +2828,12 @@ void cyMisc::SendFriendInvite(const wchar_t email[], const wchar_t toName[])
if (RelVaultNode* pNode = VaultGetPlayerNodeIncRef()) if (RelVaultNode* pNode = VaultGetPlayerNodeIncRef())
{ {
VaultPlayerNode player(pNode); 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 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); player.SetInviteUuid(inviteUuid);
} }
@ -2844,11 +2844,9 @@ void cyMisc::SendFriendInvite(const wchar_t email[], const wchar_t toName[])
PyObject* cyMisc::PyGuidGenerate() PyObject* cyMisc::PyGuidGenerate()
{ {
char guidStr[64]; plUUID newGuid = plUUID::Generate();
Uuid newGuid = GuidGenerate();
GuidToString(newGuid, guidStr, arrsize(guidStr));
return PyString_FromString(guidStr); return PyString_FromString(newGuid.AsString().c_str());
} }
PyObject* cyMisc::GetAIAvatarsByModelName(const char* name) PyObject* cyMisc::GetAIAvatarsByModelName(const char* name)

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

@ -42,6 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef cyMisc_h #ifndef cyMisc_h
#define cyMisc_h #define cyMisc_h
#include <string>
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// NAME: cyMisc // NAME: cyMisc
@ -64,8 +66,8 @@ class pyPoint3;
class pyGUIDialog; class pyGUIDialog;
class plPipeline; class plPipeline;
class plDisplayMode; class plDisplayMode;
class plUUID;
struct PipelineParams; struct PipelineParams;
struct Uuid;
typedef struct _object PyObject; typedef struct _object PyObject;
typedef struct PyMethodDef PyMethodDef; typedef struct PyMethodDef PyMethodDef;
@ -634,7 +636,7 @@ public:
static void NotifyOffererPublicLinkCompleted(uint32_t offerer); static void NotifyOffererPublicLinkCompleted(uint32_t offerer);
static void ToggleAvatarClickability(bool on); static void ToggleAvatarClickability(bool on);
static void SetShareSpawnPoint(const char* spawnPoint); static void SetShareSpawnPoint(const char* spawnPoint);
static void SetShareAgeInstanceGuid(const Uuid& guid); static void SetShareAgeInstanceGuid(const plUUID& guid);
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //

7
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 "pyGlueHelpers.h"
#include "pySceneObject.h" #include "pySceneObject.h"
#include "pnUtils/pnUtils.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") 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"); PyErr_SetString(PyExc_TypeError, "PtSetShareAgeInstanceGuid expects a string");
PYTHON_RETURN_ERROR; 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"); PyErr_SetString(PyExc_TypeError, "PtSetShareAgeInstanceGuid string parameter is not a guid string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
cyMisc::SetShareAgeInstanceGuid(guid); cyMisc::SetShareAgeInstanceGuid(guid);
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }

3
Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp

@ -906,7 +906,8 @@ PyObject *ptImportHook_load_module_detail(ptImportHook *self, char* module_name,
PyObject* modules = PyImport_GetModuleDict(); PyObject* modules = PyImport_GetModuleDict();
hsAssert(PyDict_Check(modules), "sys.modules is not a dict"); 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)) if (!PyModule_Check(result))
{ {

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

@ -47,8 +47,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#include <locale>
#include <Python.h> #include <Python.h>
#include <locale>
#include "HeadSpin.h" #include "HeadSpin.h"
#include "plgDispatch.h" #include "plgDispatch.h"
#include "pyGeometry3.h" #include "pyGeometry3.h"

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

@ -193,7 +193,7 @@ plUUID pyAgeVault::GetAgeGuid( void )
rvn->DecRef(); rvn->DecRef();
return uuid; return uuid;
} }
return plUUID(); return kNilUuid;
} }

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

@ -111,5 +111,5 @@ plUUID pyDniInfoSource::GetAgeGuid( void ) const
return uuid; return uuid;
} }
return plUUID(); return kNilUuid;
} }

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

@ -107,7 +107,7 @@ static int EnumValue_print(PyObject *self, FILE *fp, int flags)
if (text == NULL) if (text == NULL)
return -1; return -1;
fprintf(fp, text); // and print it to the file fprintf(fp, "%s", text); // and print it to the file
return 0; return 0;
} }

1
Sources/Plasma/FeatureLib/pfPython/pyGUIControlDraggable.cpp

@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include <Python.h>
#include "pyKey.h" #include "pyKey.h"
#pragma hdrstop #pragma hdrstop

1
Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.cpp

@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include <Python.h>
#include "pyKey.h" #include "pyKey.h"
#pragma hdrstop #pragma hdrstop

1
Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp

@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include <Python.h>
#include "pyKey.h" #include "pyKey.h"
#pragma hdrstop #pragma hdrstop

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

@ -141,7 +141,7 @@ void pyNotify::AddVarNumber(const char* name, float number)
fBuildMsg.AddVariableEvent(name, 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); fBuildMsg.AddVariableEvent(name, number);
} }

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

@ -97,7 +97,7 @@ public:
virtual void AddPickEvent(bool enabled, pyKey* other, pyKey* self, pyPoint3 hitPoint); virtual void AddPickEvent(bool enabled, pyKey* other, pyKey* self, pyPoint3 hitPoint);
virtual void AddControlKeyEvent( int32_t key, bool down ); virtual void AddControlKeyEvent( int32_t key, bool down );
virtual void AddVarNumber(const char* name, float number); 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 AddVarNull(const char* name);
virtual void AddVarKey(const char* name, pyKey* key); virtual void AddVarKey(const char* name, pyKey* key);
virtual void AddFacingEvent( bool enabled, pyKey* other, pyKey* self, float dot); virtual void AddFacingEvent( bool enabled, pyKey* other, pyKey* self, float dot);

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

@ -210,14 +210,14 @@ PYTHON_METHOD_DEFINITION(ptNotify, addVarNumber, args)
if (number == NULL || number == Py_None) if (number == NULL || number == Py_None)
self->fThis->AddVarNull(name); self->fThis->AddVarNull(name);
else if (PyInt_Check(number)) else if (PyInt_Check(number))
self->fThis->AddVarNumber(name, PyInt_AsLong(number)); self->fThis->AddVarNumber(name, static_cast<int32_t>(PyInt_AsLong(number)));
else if (PyLong_Check(number)) else if (PyLong_Check(number))
{ {
// try as int first // try as int first
long i = PyLong_AsLong(number); long i = PyLong_AsLong(number);
if (!PyErr_Occurred()) if (!PyErr_Occurred())
{ {
self->fThis->AddVarNumber(name, i); self->fThis->AddVarNumber(name, static_cast<int32_t>(i));
} }
else else
{ {

10
Sources/Plasma/FeatureLib/pfPython/pyVault.cpp

@ -531,7 +531,7 @@ bool pyVault::AmAgeOwner( const pyAgeInfoStruct * ageInfo )
if (!ageInfo->GetAgeInfo()) if (!ageInfo->GetAgeInfo())
return false; return false;
Uuid ageInstId = *ageInfo->GetAgeInfo()->GetAgeInstanceGuid(); plUUID ageInstId = *ageInfo->GetAgeInfo()->GetAgeInstanceGuid();
return VaultAmOwnerOfAge(ageInstId); return VaultAmOwnerOfAge(ageInstId);
} }
@ -540,7 +540,7 @@ bool pyVault::AmAgeCzar( const pyAgeInfoStruct * ageInfo )
if (!ageInfo->GetAgeInfo()) if (!ageInfo->GetAgeInfo())
return false; return false;
Uuid ageInstId = *ageInfo->GetAgeInfo()->GetAgeInstanceGuid(); plUUID ageInstId = *ageInfo->GetAgeInfo()->GetAgeInstanceGuid();
return VaultAmCzarOfAge(ageInstId); return VaultAmCzarOfAge(ageInstId);
} }
@ -574,10 +574,8 @@ void pyVault::RegisterVisitAge( const pyAgeLinkStruct & link )
void pyVault::UnRegisterVisitAge( const char * guidstr ) void pyVault::UnRegisterVisitAge( const char * guidstr )
{ {
Uuid uuid;
GuidFromString(guidstr, &uuid);
plAgeInfoStruct info; plAgeInfoStruct info;
plUUID guid(uuid); plUUID guid(guidstr);
info.SetAgeInstanceGuid(&guid); info.SetAgeInstanceGuid(&guid);
VaultUnregisterVisitAgeAndWait(&info); VaultUnregisterVisitAgeAndWait(&info);
} }
@ -671,7 +669,7 @@ void pyVault::CreateNeighborhood()
desc = plString::Format( "%s's %s", nc->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() ); 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()->SetAgeInstanceGuid(&guid);
link.GetAgeInfo()->SetAgeUserDefinedName( title.c_str() ); link.GetAgeInfo()->SetAgeUserDefinedName( title.c_str() );
link.GetAgeInfo()->SetAgeDescription( desc.c_str() ); link.GetAgeInfo()->SetAgeDescription( desc.c_str() );

10
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 "pyNetLinkingMgr.h"
#include "pyAgeInfoStruct.h" #include "pyAgeInfoStruct.h"
#include "pnUUID/pnUUID.h"
#include "plVault/plVault.h" #include "plVault/plVault.h"
// should only be created from C++ side // should only be created from C++ side
@ -228,15 +229,14 @@ void pyVaultAgeInfoNode::SetAgeUserDefinedName( const char * v )
{ {
} }
const char * pyVaultAgeInfoNode::GetAgeInstanceGuid() const plUUID pyVaultAgeInfoNode::GetAgeInstanceGuid() const
{ {
fAgeInstGuid[0] = 0;
if (fNode) { if (fNode) {
VaultAgeInfoNode access(fNode); VaultAgeInfoNode access(fNode);
GuidToString(access.ageInstUuid, fAgeInstGuid, arrsize(fAgeInstGuid));
return plUUID(access.ageInstUuid);
} }
return fAgeInstGuid; return kNilUuid;
} }
void pyVaultAgeInfoNode::SetAgeInstanceGuid( const char * sguid ) void pyVaultAgeInfoNode::SetAgeInstanceGuid( const char * sguid )

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

@ -56,12 +56,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
struct RelVaultNode; struct RelVaultNode;
class pyVaultSDLNode; class pyVaultSDLNode;
class pyAgeInfoStruct; class pyAgeInfoStruct;
class plUUID;
class pyVaultAgeInfoNode : public pyVaultNode class pyVaultAgeInfoNode : public pyVaultNode
{ {
private: private:
mutable char fAgeInstGuid[64];
mutable std::string fAgeFilename; mutable std::string fAgeFilename;
mutable std::string fAgeInstName; mutable std::string fAgeInstName;
mutable std::string fAgeUserName; mutable std::string fAgeUserName;
@ -105,7 +105,7 @@ public:
const char * GetAgeUserDefinedName() const; const char * GetAgeUserDefinedName() const;
void SetAgeUserDefinedName( const char * v ); void SetAgeUserDefinedName( const char * v );
const char * GetAgeInstanceGuid() const; plUUID GetAgeInstanceGuid() const;
void SetAgeInstanceGuid( const char * guid ); void SetAgeInstanceGuid( const char * guid );
const char * GetAgeDescription() const; const char * GetAgeDescription() const;

3
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 "pyVaultAgeInfoNode.h"
#include "plVault/plVault.h" #include "plVault/plVault.h"
#include "pnUUID/pnUUID.h"
// glue functions // glue functions
PYTHON_CLASS_DEFINITION(ptVaultAgeInfoNode, pyVaultAgeInfoNode); PYTHON_CLASS_DEFINITION(ptVaultAgeInfoNode, pyVaultAgeInfoNode);
@ -147,7 +148,7 @@ PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeUserDefinedName, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, getAgeInstanceGuid) 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) PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeInstanceGuid, args)

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

@ -64,8 +64,6 @@ class pySpawnPointInfoRef;
class pyVaultAgeLinkNode : public pyVaultNode class pyVaultAgeLinkNode : public pyVaultNode
{ {
private: private:
mutable std::string fAgeGuidStr; // for getting Age GUID
mutable plAgeLinkStruct fAgeLinkStruct; // for use with AsAgeLinkStruct() mutable plAgeLinkStruct fAgeLinkStruct; // for use with AsAgeLinkStruct()
protected: protected:

3
Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp

@ -192,7 +192,8 @@ void pyVaultImageNode::Image_SetImage(pyImage& image)
fMipmap = nil; fMipmap = nil;
} }
if (fMipmap = image.GetImage()) { fMipmap = image.GetImage();
if (fMipmap) {
VaultImageNode access(fNode); VaultImageNode access(fNode);
access.StuffImage(fMipmap); access.StuffImage(fMipmap);

12
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 "pyVaultMarkerGameNode.h"
#include "plVault/plVault.h" #include "plVault/plVault.h"
#include "pnUUID/pnUUID.h"
// should only be created from C++ side // should only be created from C++ side
pyVaultMarkerGameNode::pyVaultMarkerGameNode(RelVaultNode* nfsNode) pyVaultMarkerGameNode::pyVaultMarkerGameNode(RelVaultNode* nfsNode)
@ -88,23 +89,20 @@ void pyVaultMarkerGameNode::SetGameName (const char v[])
} }
} }
const char * pyVaultMarkerGameNode::GetGameGuid () const plUUID pyVaultMarkerGameNode::GetGameGuid() const
{ {
fGameGuid[0] = 0;
if (fNode) { if (fNode) {
VaultMarkerGameNode access(fNode); VaultMarkerGameNode access(fNode);
GuidToString(access.gameGuid, fGameGuid, arrsize(fGameGuid)); return access.gameGuid;
} }
return fGameGuid; return kNilUuid;
} }
void pyVaultMarkerGameNode::SetGameGuid (const char v[]) void pyVaultMarkerGameNode::SetGameGuid (const char v[])
{ {
if (fNode) { if (fNode) {
VaultMarkerGameNode access(fNode); VaultMarkerGameNode access(fNode);
Uuid uuid; plUUID uuid(v);
GuidFromString(v, &uuid);
access.SetGameGuid(uuid); access.SetGameGuid(uuid);
} }
} }

4
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" #include "pnNetBase/pnNetBase.h"
struct RelVaultNode; struct RelVaultNode;
class plUUID;
class pyVaultMarkerGameNode : public pyVaultNode class pyVaultMarkerGameNode : public pyVaultNode
{ {
private: private:
mutable char fGameName[kMaxVaultNodeStringLength]; mutable char fGameName[kMaxVaultNodeStringLength];
mutable char fGameGuid[64];
protected: protected:
// should only be created from C++ side // should only be created from C++ side
@ -86,7 +86,7 @@ public:
const char * GetGameName () const; const char * GetGameName () const;
void SetGameName (const char v[]); void SetGameName (const char v[]);
const char * GetGameGuid () const; plUUID GetGameGuid() const;
void SetGameGuid (const char v[]); void SetGameGuid (const char v[]);
}; };

3
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 "pyVaultMarkerGameNode.h"
#include "plVault/plVault.h" #include "plVault/plVault.h"
#include "pnUUID/pnUUID.h"
// glue functions // glue functions
PYTHON_CLASS_DEFINITION(ptVaultMarkerGameNode, pyVaultMarkerGameNode); PYTHON_CLASS_DEFINITION(ptVaultMarkerGameNode, pyVaultMarkerGameNode);
@ -84,7 +85,7 @@ PYTHON_METHOD_DEFINITION(ptVaultMarkerGameNode, setGameName, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultMarkerGameNode, getGameGuid) 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) PYTHON_METHOD_DEFINITION(ptVaultMarkerGameNode, setGameGuid, args)

27
Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp

@ -45,17 +45,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
#include <exception>
#include <Python.h> #include <Python.h>
#include <exception>
#pragma hdrstop #pragma hdrstop
#include "pyVaultNode.h" #include "pyVaultNode.h"
#ifndef BUILDING_PYPLASMA #ifndef BUILDING_PYPLASMA
# include "pyVault.h" # include "pyVault.h"
# include "pyVaultSystemNode.h" # include "pyVaultSystemNode.h"
# include "pnNetCommon/plNetApp.h" # include "pnNetCommon/plNetApp.h"
# include "plNetClientComm/plNetClientComm.h" # include "plNetClientComm/plNetClientComm.h"
#endif #endif
#include "pyImage.h" #include "pyImage.h"
#include "pyDniCoordinates.h" #include "pyDniCoordinates.h"
#include "pyVaultNodeRef.h" #include "pyVaultNodeRef.h"
@ -72,6 +74,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pyVaultPlayerNode.h" #include "pyVaultPlayerNode.h"
#include "pyVaultSDLNode.h" #include "pyVaultSDLNode.h"
#include "pnUUID/pnUUID.h"
#include "plGImage/plMipmap.h" #include "plGImage/plMipmap.h"
#include "plVault/plVault.h" #include "plVault/plVault.h"
@ -168,7 +171,6 @@ RelVaultNode * pyVaultNode::pyVaultNodeOperationCallback::GetNode () {
// only for python glue, do NOT call // only for python glue, do NOT call
pyVaultNode::pyVaultNode() pyVaultNode::pyVaultNode()
: fNode(nil) : fNode(nil)
, fCreateAgeGuid(nil)
, fCreateAgeName(nil) , fCreateAgeName(nil)
{ {
} }
@ -176,7 +178,6 @@ pyVaultNode::pyVaultNode()
// should only be created from C++ side // should only be created from C++ side
pyVaultNode::pyVaultNode( RelVaultNode* nfsNode ) pyVaultNode::pyVaultNode( RelVaultNode* nfsNode )
: fNode(nfsNode) : fNode(nfsNode)
, fCreateAgeGuid(nil)
, fCreateAgeName(nil) , fCreateAgeName(nil)
{ {
if (fNode) if (fNode)
@ -187,7 +188,6 @@ pyVaultNode::~pyVaultNode()
{ {
if (fNode) if (fNode)
fNode->DecRef("pyVaultNode"); fNode->DecRef("pyVaultNode");
free(fCreateAgeGuid);
free(fCreateAgeName); free(fCreateAgeName);
} }
@ -322,20 +322,13 @@ const char * pyVaultNode::GetCreateAgeName( void )
return fCreateAgeName; return fCreateAgeName;
} }
const char * pyVaultNode::GetCreateAgeGuid( void ) plUUID pyVaultNode::GetCreateAgeGuid(void) const
{ {
if (!fNode)
return "";
if (fCreateAgeGuid)
return fCreateAgeGuid;
if (fNode) { if (fNode) {
fCreateAgeGuid = (char*)malloc(64); return fNode->createAgeUuid;
GuidToString(fNode->createAgeUuid, fCreateAgeGuid, 64);
} }
return fCreateAgeGuid; return kNilUuid;
} }
PyObject* pyVaultNode::GetCreateAgeCoords () { PyObject* pyVaultNode::GetCreateAgeCoords () {
@ -390,12 +383,8 @@ void pyVaultNode::SetCreateAgeName( const char * v )
void pyVaultNode::SetCreateAgeGuid( const char * v ) void pyVaultNode::SetCreateAgeGuid( const char * v )
{ {
free(fCreateAgeGuid);
fCreateAgeGuid = nil;
ASSERT(fNode); ASSERT(fNode);
Uuid uuid; plUUID uuid(v);
GuidFromString(v, &uuid);
fNode->SetCreateAgeUuid(uuid); fNode->SetCreateAgeUuid(uuid);
} }

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

@ -54,6 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
struct RelVaultNode; struct RelVaultNode;
class plMipmap; class plMipmap;
class pyImage; class pyImage;
class plUUID;
class pyDniCoordinates; class pyDniCoordinates;
@ -97,7 +98,6 @@ public:
}; };
RelVaultNode * fNode; RelVaultNode * fNode;
mutable char * fCreateAgeGuid;
mutable char * fCreateAgeName; mutable char * fCreateAgeName;
protected: protected:
@ -138,7 +138,7 @@ public:
uint32_t GetCreateTime( void ); uint32_t GetCreateTime( void );
uint32_t GetCreateAgeTime( void ); uint32_t GetCreateAgeTime( void );
const char * GetCreateAgeName( void ); const char * GetCreateAgeName( void );
const char * GetCreateAgeGuid( void ); plUUID GetCreateAgeGuid(void) const;
PyObject* GetCreateAgeCoords (); PyObject* GetCreateAgeCoords ();
// public setters // public setters

3
Sources/Plasma/FeatureLib/pfPython/pyVaultNodeGlue.cpp

@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#pragma hdrstop #pragma hdrstop
#include "pyVaultNode.h" #include "pyVaultNode.h"
#include "pnUUID/pnUUID.h"
#include "plVault/plVault.h" #include "plVault/plVault.h"
// glue functions // glue functions
@ -153,7 +154,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptVaultNode, getCreateAgeName)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultNode, getCreateAgeGuid) 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) PYTHON_METHOD_DEFINITION_NOARGS(ptVaultNode, getCreateAgeCoords)

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

@ -45,8 +45,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <Python.h> #include <Python.h>
#include <algorithm>
#pragma hdrstop #pragma hdrstop
#include "pyVaultPlayerInfoListNode.h" #include "pyVaultPlayerInfoListNode.h"

15
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 "pyVaultPlayerInfoNode.h"
#include "plVault/plVault.h" #include "plVault/plVault.h"
#include "pnUUID/pnUUID.h"
#ifndef BUILDING_PYPLASMA #ifndef BUILDING_PYPLASMA
# include "pyVault.h" # include "pyVault.h"
#endif #endif
@ -152,20 +153,18 @@ void pyVaultPlayerInfoNode::Player_SetAgeGuid( const char * guidtext)
if (!fNode) if (!fNode)
return; return;
Uuid ageInstId; plUUID ageInstId(guidtext);
GuidFromString(guidtext, &ageInstId);
VaultPlayerInfoNode playerInfo(fNode); VaultPlayerInfoNode playerInfo(fNode);
playerInfo.SetAgeInstUuid(ageInstId); playerInfo.SetAgeInstUuid(ageInstId);
} }
const char * pyVaultPlayerInfoNode::Player_GetAgeGuid( void ) plUUID pyVaultPlayerInfoNode::Player_GetAgeGuid(void) const
{ {
if (!fNode) if (fNode) {
return "";
VaultPlayerInfoNode playerInfo(fNode); VaultPlayerInfoNode playerInfo(fNode);
GuidToString(playerInfo.ageInstUuid, ansiAgeInstUuid, arrsize(ansiAgeInstUuid)); return playerInfo.ageInstUuid;
return ansiAgeInstUuid; }
return kNilUuid;
} }
// online status // online status

5
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 "pyVaultNode.h"
#include "pyGlueHelpers.h" #include "pyGlueHelpers.h"
class plUUID;
class pyVaultPlayerInfoNode : public pyVaultNode class pyVaultPlayerInfoNode : public pyVaultNode
{ {
mutable char * ansiPlayerName; mutable char * ansiPlayerName;
mutable char * ansiAgeInstName; mutable char * ansiAgeInstName;
mutable char ansiAgeInstUuid[256];
protected: protected:
// should only be created from C++ side // should only be created from C++ side
@ -88,7 +89,7 @@ public:
void Player_SetAgeInstanceName( const char * agename ); void Player_SetAgeInstanceName( const char * agename );
const char * Player_GetAgeInstanceName( void ); const char * Player_GetAgeInstanceName( void );
void Player_SetAgeGuid( const char * guidtext); void Player_SetAgeGuid( const char * guidtext);
const char * Player_GetAgeGuid( void ); plUUID Player_GetAgeGuid(void) const;
// online status // online status
void Player_SetOnline( bool b ); void Player_SetOnline( bool b );
bool Player_IsOnline( void ); bool Player_IsOnline( void );

3
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp

@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#pragma hdrstop #pragma hdrstop
#include "pyVaultPlayerInfoNode.h" #include "pyVaultPlayerInfoNode.h"
#include "pnUUID/pnUUID.h"
#include "plVault/plVault.h" #include "plVault/plVault.h"
// glue functions // glue functions
@ -122,7 +123,7 @@ PYTHON_METHOD_DEFINITION(ptVaultPlayerInfoNode, playerSetAgeGuid, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultPlayerInfoNode, playerGetAgeGuid) 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) PYTHON_METHOD_DEFINITION(ptVaultPlayerInfoNode, playerSetOnline, args)

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

@ -236,10 +236,8 @@ PyObject *pyVaultPlayerNode::GetVisitAgeLink(const pyAgeInfoStruct *info)
void pyVaultPlayerNode::RemoveVisitAgeLink(const char *guidstr) void pyVaultPlayerNode::RemoveVisitAgeLink(const char *guidstr)
{ {
Uuid uuid;
GuidFromString(guidstr, &uuid);
plAgeInfoStruct info; plAgeInfoStruct info;
plUUID guid(uuid); plUUID guid(guidstr);
info.SetAgeInstanceGuid(&guid); info.SetAgeInstanceGuid(&guid);
VaultUnregisterOwnedAgeAndWait(&info); VaultUnregisterOwnedAgeAndWait(&info);
} }

11
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 #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNASYNCCORE_PRIVATE_PNACIO_H
#include "pnNetCommon/plNetAddress.h" #include "pnNetCommon/plNetAddress.h"
#include "pnUUID/pnUUID.h"
/**************************************************************************** /****************************************************************************
@ -79,7 +80,7 @@ struct AsyncSocketConnectPacket {
uint32_t buildId; uint32_t buildId;
uint32_t buildType; uint32_t buildType;
uint32_t branchId; uint32_t branchId;
Uuid productId; plUUID productId;
}; };
#pragma pack(pop) #pragma pack(pop)
@ -114,7 +115,7 @@ struct AsyncNotifySocketListen : AsyncNotifySocketConnect {
unsigned buildId; unsigned buildId;
unsigned buildType; unsigned buildType;
unsigned branchId; unsigned branchId;
Uuid productId; plUUID productId;
plNetAddress addr; plNetAddress addr;
uint8_t * buffer; uint8_t * buffer;
unsigned bytes; unsigned bytes;
@ -183,7 +184,7 @@ void AsyncSocketRegisterNotifyProc (
unsigned buildId = 0, unsigned buildId = 0,
unsigned buildType = 0, unsigned buildType = 0,
unsigned branchId = 0, unsigned branchId = 0,
const Uuid & productId = kNilGuid const plUUID& productId = kNilUuid
); );
void AsyncSocketUnregisterNotifyProc ( void AsyncSocketUnregisterNotifyProc (
@ -192,7 +193,7 @@ void AsyncSocketUnregisterNotifyProc (
unsigned buildId = 0, unsigned buildId = 0,
unsigned buildType = 0, unsigned buildType = 0,
unsigned branchId = 0, unsigned branchId = 0,
const Uuid & productId = kNilGuid const plUUID& productId = kNilUuid
); );
FAsyncNotifySocketProc AsyncSocketFindNotifyProc ( FAsyncNotifySocketProc AsyncSocketFindNotifyProc (
@ -203,7 +204,7 @@ FAsyncNotifySocketProc AsyncSocketFindNotifyProc (
unsigned * buildId, unsigned * buildId,
unsigned * buildType, unsigned * buildType,
unsigned * branchId, unsigned * branchId,
Uuid * productId plUUID* productId
); );

2
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp

@ -489,7 +489,7 @@ static void SocketInitListen (
notify.buildId = 0; notify.buildId = 0;
notify.buildType = 0; notify.buildType = 0;
notify.branchId = 0; notify.branchId = 0;
notify.productId = 0; notify.productId = kNilUuid;
notify.addr = listenAddr; notify.addr = listenAddr;
notify.buffer = sock->opRead.read.buffer; notify.buffer = sock->opRead.read.buffer;
notify.bytes = 0; notify.bytes = 0;

18
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 buildId; [optional]
// uint32_t branchId; [optional] // uint32_t branchId; [optional]
// uint32_t buildType; [optional] // uint32_t buildType; [optional]
// Uuid productId; [optional] // plUUID productId; [optional]
const unsigned kConnHashFlagsIgnore = 0x01; const unsigned kConnHashFlagsIgnore = 0x01;
const unsigned kConnHashFlagsExactMatch = 0x02; const unsigned kConnHashFlagsExactMatch = 0x02;
struct ISocketConnHash { struct ISocketConnHash {
@ -70,7 +70,7 @@ struct ISocketConnHash {
unsigned buildId; unsigned buildId;
unsigned buildType; unsigned buildType;
unsigned branchId; unsigned branchId;
Uuid productId; plUUID productId;
unsigned flags; unsigned flags;
unsigned GetHash () const; unsigned GetHash () const;
@ -102,7 +102,7 @@ unsigned ISocketConnHash::GetHash () const {
hash.Hash32(buildType); hash.Hash32(buildType);
if (branchId) if (branchId)
hash.Hash32(branchId); hash.Hash32(branchId);
if (productId != kNilGuid) if (productId != kNilUuid)
hash.Hash(&productId, sizeof(productId)); hash.Hash(&productId, sizeof(productId));
*/ */
return hash.GetHash(); return hash.GetHash();
@ -145,7 +145,7 @@ bool ISocketConnHash::operator== (const ISocketConnHash & rhs) const {
if (productId != rhs.productId) { if (productId != rhs.productId) {
if (rhs.flags & kConnHashFlagsExactMatch) if (rhs.flags & kConnHashFlagsExactMatch)
break; break;
if (productId != kNilGuid) if (productId != kNilUuid)
break; break;
} }
@ -171,7 +171,7 @@ static unsigned GetConnHash (
hash->buildId = 0; hash->buildId = 0;
hash->buildType = 0; hash->buildType = 0;
hash->branchId = 0; hash->branchId = 0;
hash->productId = 0; hash->productId = kNilUuid;
hash->flags = 0; hash->flags = 0;
// one uint8_t consumed // one uint8_t consumed
@ -325,7 +325,7 @@ void AsyncSocketRegisterNotifyProc (
unsigned buildId, unsigned buildId,
unsigned buildType, unsigned buildType,
unsigned branchId, unsigned branchId,
const Uuid & productId const plUUID& productId
) { ) {
ASSERT(connType != kConnTypeNil); ASSERT(connType != kConnTypeNil);
ASSERT(notifyProc); ASSERT(notifyProc);
@ -354,7 +354,7 @@ void AsyncSocketUnregisterNotifyProc (
unsigned buildId, unsigned buildId,
unsigned buildType, unsigned buildType,
unsigned branchId, unsigned branchId,
const Uuid & productId const plUUID& productId
) { ) {
ISocketConnHash hash; ISocketConnHash hash;
hash.connType = connType; hash.connType = connType;
@ -392,7 +392,7 @@ FAsyncNotifySocketProc AsyncSocketFindNotifyProc (
unsigned * buildId, unsigned * buildId,
unsigned * buildType, unsigned * buildType,
unsigned * branchId, unsigned * branchId,
Uuid * productId plUUID* productId
) { ) {
for (;;) { for (;;) {
// Get the connType // Get the connType
@ -428,6 +428,6 @@ FAsyncNotifySocketProc AsyncSocketFindNotifyProc (
*buildId = 0; *buildId = 0;
*buildType = 0; *buildType = 0;
*branchId = 0; *branchId = 0;
*productId = 0; *productId = kNilUuid;
return nil; return nil;
} }

2
Sources/Plasma/NucleusLib/pnGameMgr/BlueSpiral/pnGmBlueSpiral.h

@ -68,7 +68,7 @@ enum EBlueSpiralInitResult {
// Game type id // Game type id
//============================================================================ //============================================================================
const Uuid kGameTypeId_BlueSpiral = Uuid(L"5ff98165-913e-4fd1-a2c2-9c7f31be2cc8"); const plUUID kGameTypeId_BlueSpiral("5ff98165-913e-4fd1-a2c2-9c7f31be2cc8");
//============================================================================ //============================================================================

2
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 // Game type id
//============================================================================ //============================================================================
const Uuid kGameTypeId_ClimbingWall = Uuid(L"6224cdf4-3556-4740-b7cd-d637562d07be"); const plUUID kGameTypeId_ClimbingWall("6224cdf4-3556-4740-b7cd-d637562d07be");
//============================================================================ //============================================================================

2
Sources/Plasma/NucleusLib/pnGameMgr/Heek/pnGmHeek.h

@ -91,7 +91,7 @@ enum EHeekCountdownState {
// Game type id // Game type id
//============================================================================ //============================================================================
const Uuid kGameTypeId_Heek = Uuid(L"9d83c2e2-7835-4477-9aaa-22254c59a753"); const plUUID kGameTypeId_Heek("9d83c2e2-7835-4477-9aaa-22254c59a753");
//============================================================================ //============================================================================

2
Sources/Plasma/NucleusLib/pnGameMgr/Marker/pnGmMarker.h

@ -75,7 +75,7 @@ enum EMarkerGameType {
// Game type id // Game type id
//============================================================================ //============================================================================
const Uuid kGameTypeId_Marker = Uuid(L"000b2c39-0319-4be1-b06c-7a105b160fcf"); const plUUID kGameTypeId_Marker("000b2c39-0319-4be1-b06c-7a105b160fcf");
//============================================================================ //============================================================================

1
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 "pnUtils/pnUtils.h"
#include "pnNetBase/pnNetBase.h" #include "pnNetBase/pnNetBase.h"
#include "pnProduct/pnProduct.h" #include "pnProduct/pnProduct.h"
#include "pnUUID/pnUUID.h"
#include "pnGameMgr.h" #include "pnGameMgr.h"
#include "Intern.h" #include "Intern.h"

2
Sources/Plasma/NucleusLib/pnGameMgr/TicTacToe/pnGmTicTacToe.h

@ -74,7 +74,7 @@ enum ETTTGameResult {
// Game type id // Game type id
//============================================================================ //============================================================================
const Uuid kGameTypeId_TicTacToe = Uuid(L"a7236529-11d8-4758-9368-59cb43445a83"); const plUUID kGameTypeId_TicTacToe("a7236529-11d8-4758-9368-59cb43445a83");
//============================================================================ //============================================================================

2
Sources/Plasma/NucleusLib/pnGameMgr/VarSync/pnGmVarSync.h

@ -68,7 +68,7 @@ enum EVarSyncInitResult {
// Game type id // Game type id
//============================================================================ //============================================================================
const Uuid kGameTypeId_VarSync = Uuid(L"475c2e9b-a245-4106-a047-9b25d41ff333"); const plUUID kGameTypeId_VarSync("475c2e9b-a245-4106-a047-9b25d41ff333");
//============================================================================ //============================================================================

10
Sources/Plasma/NucleusLib/pnGameMgr/pnGameMgr.h

@ -181,7 +181,7 @@ enum {
// Cli2Srv // Cli2Srv
struct Cli2Srv_GameMgr_CreateGame : GameMsgHeader { struct Cli2Srv_GameMgr_CreateGame : GameMsgHeader {
Uuid gameTypeId; plUUID gameTypeId;
uint32_t createOptions; uint32_t createOptions;
uint32_t createDataBytes; uint32_t createDataBytes;
uint8_t createData[1]; // [createDataBytes] uint8_t createData[1]; // [createDataBytes]
@ -190,7 +190,7 @@ enum {
// Field ordering here is vitally important, see pfGameMgr::JoinGame for explanation // Field ordering here is vitally important, see pfGameMgr::JoinGame for explanation
uint32_t newGameId; uint32_t newGameId;
uint32_t createOptions; uint32_t createOptions;
Uuid gameTypeId; plUUID gameTypeId;
uint32_t createDataBytes; uint32_t createDataBytes;
uint8_t createData[1]; // [createDataBytes] uint8_t createData[1]; // [createDataBytes]
}; };
@ -199,17 +199,17 @@ enum {
struct Srv2Cli_GameMgr_GameInstance : GameMsgHeader { struct Srv2Cli_GameMgr_GameInstance : GameMsgHeader {
EGameJoinError result; EGameJoinError result;
uint32_t ownerId; uint32_t ownerId;
Uuid gameTypeId; plUUID gameTypeId;
uint32_t newGameId; uint32_t newGameId;
}; };
struct Srv2Cli_GameMgr_InviteReceived : GameMsgHeader { struct Srv2Cli_GameMgr_InviteReceived : GameMsgHeader {
uint32_t inviterId; uint32_t inviterId;
Uuid gameTypeId; plUUID gameTypeId;
uint32_t newGameId; uint32_t newGameId;
}; };
struct Srv2Cli_GameMgr_InviteRevoked : GameMsgHeader { struct Srv2Cli_GameMgr_InviteRevoked : GameMsgHeader {
uint32_t inviterId; uint32_t inviterId;
Uuid gameTypeId; plUUID gameTypeId;
uint32_t newGameId; uint32_t newGameId;
}; };

2
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 // 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 // create the control key event record
proVariableEventData* pED = new proVariableEventData; proVariableEventData* pED = new proVariableEventData;

2
Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h

@ -376,7 +376,7 @@ public:
void AddPickEvent( const plKey &other, const plKey& self, bool enabled, hsPoint3 hitPoint ); void AddPickEvent( const plKey &other, const plKey& self, bool enabled, hsPoint3 hitPoint );
void AddControlKeyEvent( int32_t key, bool down ); void AddControlKeyEvent( int32_t key, bool down );
void AddVariableEvent( const char* name, float number ); 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 );
void AddVariableEvent( const char *name, const plKey &key ); void AddVariableEvent( const char *name, const plKey &key );
void AddFacingEvent( const plKey &other, const plKey &self, float dot, bool enabled); void AddFacingEvent( const plKey &other, const plKey &self, float dot, bool enabled);

4
Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp

@ -49,6 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#pragma hdrstop #pragma hdrstop
#include "pnEncryption/plChallengeHash.h" #include "pnEncryption/plChallengeHash.h"
#include "pnUUID/pnUUID.h"
//#define NCCLI_DEBUGGING //#define NCCLI_DEBUGGING
#ifdef NCCLI_DEBUGGING #ifdef NCCLI_DEBUGGING
@ -112,7 +113,7 @@ enum ENetCliMode {
***/ ***/
// connection structure attached to each socket // connection structure attached to each socket
struct NetCli : THashKeyVal<Uuid> { struct NetCli {
// communication channel // communication channel
AsyncSocket sock; AsyncSocket sock;
@ -917,7 +918,6 @@ static NetCli * ConnCreate (
cli->protocol = (ENetProtocol) protocol; cli->protocol = (ENetProtocol) protocol;
cli->channel = channel; cli->channel = channel;
cli->mode = mode; cli->mode = mode;
cli->SetValue(kNilGuid);
#if !defined(PLASMA_EXTERNAL_RELEASE) && defined(HS_BUILD_FOR_WIN32) #if !defined(PLASMA_EXTERNAL_RELEASE) && defined(HS_BUILD_FOR_WIN32)
// Network debug pipe // Network debug pipe

22
Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.cpp

@ -105,25 +105,31 @@ uint32_t GetBinAddr(const char * textAddr)
void plCreatableStream::Write( hsStream* stream, hsResMgr* mgr ) void plCreatableStream::Write( hsStream* stream, hsResMgr* mgr )
{ {
fStream.Rewind(); fStream.Rewind();
std::string buf;
uint32_t len = fStream.GetEOF(); uint32_t len = fStream.GetEOF();
stream->WriteLE( len ); stream->WriteLE( len );
buf.resize( len );
fStream.Read( len, (void*)buf.data() ); uint8_t* buf = new uint8_t[len];
stream->Write( len, (const void*)buf.data() ); fStream.Read(len, (void*)buf);
stream->Write(len, (const void*)buf);
fStream.Rewind(); fStream.Rewind();
delete[] buf;
} }
void plCreatableStream::Read( hsStream* stream, hsResMgr* mgr ) void plCreatableStream::Read( hsStream* stream, hsResMgr* mgr )
{ {
fStream.Rewind(); fStream.Rewind();
std::string buf;
uint32_t len; uint32_t len;
stream->LogReadLE( &len,"CreatableStream Len"); stream->LogReadLE( &len,"CreatableStream Len");
buf.resize( len );
stream->LogRead( len, (void*)buf.data(),"CreatableStream Data"); uint8_t* buf = new uint8_t[len];
fStream.Write( len, (const void*)buf.data() ); stream->LogRead(len, (void*)buf, "CreatableStream Data");
fStream.Write(len, (const void*)buf);
fStream.Rewind(); fStream.Rewind();
delete[] buf;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

1
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 "pnNetBase/pnNetBase.h"
#include "pnAsyncCore/pnAsyncCore.h" #include "pnAsyncCore/pnAsyncCore.h"
#include "pnNetCli/pnNetCli.h" #include "pnNetCli/pnNetCli.h"
#include "pnUUID/pnUUID.h"
#ifdef SERVER #ifdef SERVER
#include "psUtils/psUtils.h" // for SrvMsgHeader, ugh #include "psUtils/psUtils.h" // for SrvMsgHeader, ugh

30
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 { struct Cli2Auth_ConnData {
uint32_t dataBytes; uint32_t dataBytes;
Uuid token; plUUID token;
}; };
struct Cli2Auth_Connect { struct Cli2Auth_Connect {
AsyncSocketConnectPacket hdr; AsyncSocketConnectPacket hdr;
@ -286,7 +286,7 @@ struct Cli2Auth_AgeRequest {
uint32_t messageId; uint32_t messageId;
uint32_t transId; uint32_t transId;
wchar_t ageName[kMaxAgeNameLength]; wchar_t ageName[kMaxAgeNameLength];
Uuid ageUuid; plUUID ageUuid;
}; };
// AcctCreateRequest // AcctCreateRequest
@ -307,7 +307,7 @@ struct Cli2Auth_AcctCreateFromKeyRequest {
uint32_t transId; uint32_t transId;
wchar_t accountName[kMaxAccountNameLength]; wchar_t accountName[kMaxAccountNameLength];
ShaDigest namePassHash; ShaDigest namePassHash;
Uuid key; plUUID key;
uint32_t billingType; uint32_t billingType;
}; };
@ -375,7 +375,7 @@ extern const NetMsg kNetMsg_Cli2Auth_AcctActivateRequest;
struct Cli2Auth_AcctActivateRequest { struct Cli2Auth_AcctActivateRequest {
uint32_t messageId; uint32_t messageId;
uint32_t transId; uint32_t transId;
Uuid activationKey; plUUID activationKey;
}; };
// FileListRequest // FileListRequest
@ -435,7 +435,7 @@ struct Cli2Auth_VaultNodeSave {
uint32_t messageId; uint32_t messageId;
uint32_t transId; uint32_t transId;
uint32_t nodeId; uint32_t nodeId;
Uuid revisionId; plUUID revisionId;
uint32_t nodeBytes; uint32_t nodeBytes;
uint8_t nodeBuffer[1]; uint8_t nodeBuffer[1];
}; };
@ -462,8 +462,8 @@ extern const NetMsg kNetMsg_Cli2Auth_VaultInitAgeRequest;
struct Cli2Auth_VaultInitAgeRequest { struct Cli2Auth_VaultInitAgeRequest {
uint32_t messageId; uint32_t messageId;
uint32_t transId; uint32_t transId;
Uuid ageInstId; plUUID ageInstId;
Uuid parentAgeInstId; plUUID parentAgeInstId;
wchar_t ageFilename[MAX_PATH]; wchar_t ageFilename[MAX_PATH];
wchar_t ageInstName[MAX_PATH]; wchar_t ageInstName[MAX_PATH];
wchar_t ageUserName[MAX_PATH]; wchar_t ageUserName[MAX_PATH];
@ -572,7 +572,7 @@ extern const NetMsg kNetMsg_Cli2Auth_SendFriendInviteRequest;
struct Cli2Auth_SendFriendInviteRequest { struct Cli2Auth_SendFriendInviteRequest {
uint32_t messageId; uint32_t messageId;
uint32_t transId; uint32_t transId;
Uuid inviteUuid; plUUID inviteUuid;
wchar_t emailAddress[kMaxEmailAddressLength]; wchar_t emailAddress[kMaxEmailAddressLength];
wchar_t toName[kMaxPlayerNameLength]; wchar_t toName[kMaxPlayerNameLength];
}; };
@ -679,7 +679,7 @@ extern const NetMsg kNetMsg_Auth2Cli_ServerAddr;
struct Auth2Cli_ServerAddr { struct Auth2Cli_ServerAddr {
uint32_t messageId; uint32_t messageId;
uint32_t srvAddr; uint32_t srvAddr;
Uuid token; plUUID token;
}; };
extern const NetMsg kNetMsg_Auth2Cli_NotifyNewBuild; extern const NetMsg kNetMsg_Auth2Cli_NotifyNewBuild;
@ -704,7 +704,7 @@ struct Auth2Cli_AcctLoginReply {
uint32_t messageId; uint32_t messageId;
uint32_t transId; uint32_t transId;
ENetError result; ENetError result;
Uuid accountId; plUUID accountId;
uint32_t accountFlags; uint32_t accountFlags;
uint32_t billingType; uint32_t billingType;
uint32_t encryptionKey[4]; uint32_t encryptionKey[4];
@ -717,7 +717,7 @@ struct Auth2Cli_AgeReply {
uint32_t transId; uint32_t transId;
ENetError result; ENetError result;
uint32_t ageMcpId; uint32_t ageMcpId;
Uuid ageInstId; plUUID ageInstId;
uint32_t ageVaultId; uint32_t ageVaultId;
uint32_t gameSrvNode; uint32_t gameSrvNode;
}; };
@ -728,7 +728,7 @@ struct Auth2Cli_AcctCreateReply {
uint32_t messageId; uint32_t messageId;
uint32_t transId; uint32_t transId;
ENetError result; ENetError result;
Uuid accountId; plUUID accountId;
}; };
// AcctCreateFromKeyReply // AcctCreateFromKeyReply
@ -737,8 +737,8 @@ struct Auth2Cli_AcctCreateFromKeyReply {
uint32_t messageId; uint32_t messageId;
uint32_t transId; uint32_t transId;
ENetError result; ENetError result;
Uuid accountId; plUUID accountId;
Uuid activationKey; plUUID activationKey;
}; };
// CreatePlayerReply // CreatePlayerReply
@ -870,7 +870,7 @@ extern const NetMsg kNetMsg_Auth2Cli_VaultNodeChanged;
struct Auth2Cli_VaultNodeChanged { struct Auth2Cli_VaultNodeChanged {
uint32_t messageId; uint32_t messageId;
uint32_t nodeId; uint32_t nodeId;
Uuid revisionId; plUUID revisionId;
}; };
extern const NetMsg kNetMsg_Auth2Cli_VaultNodeAdded; extern const NetMsg kNetMsg_Auth2Cli_VaultNodeAdded;

6
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 { struct Cli2Game_ConnData {
uint32_t dataBytes; uint32_t dataBytes;
Uuid accountUuid; plUUID accountUuid;
Uuid ageUuid; plUUID ageUuid;
}; };
struct Cli2Game_Connect { struct Cli2Game_Connect {
AsyncSocketConnectPacket hdr; AsyncSocketConnectPacket hdr;
@ -125,7 +125,7 @@ struct Cli2Game_JoinAgeRequest {
uint32_t messageId; uint32_t messageId;
uint32_t transId; uint32_t transId;
uint32_t ageMcpId; uint32_t ageMcpId;
Uuid accountUuid; plUUID accountUuid;
uint32_t playerInt; uint32_t playerInt;
}; };

2
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h

@ -89,7 +89,7 @@ static_assert(kNumGateKeeper2CliMessages <= 0xFFFF, "GateKeeper2Cli message type
struct Cli2GateKeeper_ConnData { struct Cli2GateKeeper_ConnData {
uint32_t dataBytes; uint32_t dataBytes;
Uuid token; plUUID token;
}; };
struct Cli2GateKeeper_Connect { struct Cli2GateKeeper_Connect {

42
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.h

@ -201,7 +201,7 @@ struct Srv2Db_AccountCreateRequest : SrvMsgHeader {
struct Srv2Db_AccountCreateFromKeyRequest : SrvMsgHeader { struct Srv2Db_AccountCreateFromKeyRequest : SrvMsgHeader {
wchar_t accountName[kMaxAccountNameLength]; wchar_t accountName[kMaxAccountNameLength];
ShaDigest namePassHash; ShaDigest namePassHash;
Uuid key; plUUID key;
uint32_t billingType; uint32_t billingType;
}; };
@ -215,7 +215,7 @@ struct Srv2Db_AccountLoginRequest2 : SrvMsgHeader {
}; };
struct Srv2Db_AccountLogout : SrvMsgHeader { struct Srv2Db_AccountLogout : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
uint32_t timeLoggedMins; uint32_t timeLoggedMins;
}; };
@ -235,16 +235,16 @@ struct Srv2Db_AccountSetBillingTypeRequest : SrvMsgHeader {
}; };
struct Srv2Db_AccountActivateRequest : SrvMsgHeader { struct Srv2Db_AccountActivateRequest : SrvMsgHeader {
Uuid activationKey; plUUID activationKey;
}; };
struct Srv2Db_AccountLockPlayerNameRequest :SrvMsgHeader { struct Srv2Db_AccountLockPlayerNameRequest :SrvMsgHeader {
wchar_t playerName[kMaxPlayerNameLength]; wchar_t playerName[kMaxPlayerNameLength];
Uuid accountUuid; plUUID accountUuid;
}; };
struct Srv2Db_VaultNodeCreateRequest : SrvMsgHeader { struct Srv2Db_VaultNodeCreateRequest : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
uint32_t creatorId; uint32_t creatorId;
uint32_t nodeBytes; uint32_t nodeBytes;
uint8_t nodeBuffer[1]; uint8_t nodeBuffer[1];
@ -256,11 +256,11 @@ struct Srv2Db_VaultNodeFetchRequest : SrvMsgHeader {
struct Srv2Db_VaultNodeChanged : SrvMsgHeader { struct Srv2Db_VaultNodeChanged : SrvMsgHeader {
uint32_t nodeId; uint32_t nodeId;
Uuid revisionId; plUUID revisionId;
}; };
struct Srv2Db_VaultNodeSaveRequest : SrvMsgHeader { struct Srv2Db_VaultNodeSaveRequest : SrvMsgHeader {
Uuid revisionId; plUUID revisionId;
uint32_t nodeId; uint32_t nodeId;
unsigned playerCheckId; unsigned playerCheckId;
unsigned isRequestFromAuth; unsigned isRequestFromAuth;
@ -321,7 +321,7 @@ struct Srv2Db_SetAgeSequenceNumRequest : SrvMsgHeader {
struct Srv2Db_StateSaveObject : SrvMsgHeader { struct Srv2Db_StateSaveObject : SrvMsgHeader {
uint32_t buildId; uint32_t buildId;
Uuid ownerId; plUUID ownerId;
wchar_t objectName[kMaxStateObjectName]; wchar_t objectName[kMaxStateObjectName];
uint32_t objectDataBytes; uint32_t objectDataBytes;
uint8_t objectData[1]; uint8_t objectData[1];
@ -329,12 +329,12 @@ struct Srv2Db_StateSaveObject : SrvMsgHeader {
}; };
struct Srv2Db_StateDeleteObject : SrvMsgHeader { struct Srv2Db_StateDeleteObject : SrvMsgHeader {
Uuid ownerId; plUUID ownerId;
wchar_t objectName[kMaxStateObjectName]; wchar_t objectName[kMaxStateObjectName];
}; };
struct Srv2Db_StateFetchObject : SrvMsgHeader { struct Srv2Db_StateFetchObject : SrvMsgHeader {
Uuid ownerId; plUUID ownerId;
wchar_t objectName[kMaxStateObjectName]; wchar_t objectName[kMaxStateObjectName];
}; };
@ -400,11 +400,11 @@ struct Srv2Db_PlayerOffline : SrvMsgHeader {
}; };
struct Srv2Db_AgeOnline : SrvMsgHeader { struct Srv2Db_AgeOnline : SrvMsgHeader {
Uuid ageInstId; plUUID ageInstId;
}; };
struct Srv2Db_AgeOffline : SrvMsgHeader { struct Srv2Db_AgeOffline : SrvMsgHeader {
Uuid ageInstId; plUUID ageInstId;
}; };
struct Srv2Db_CsrAcctInfoRequest : SrvMsgHeader { struct Srv2Db_CsrAcctInfoRequest : SrvMsgHeader {
@ -412,7 +412,7 @@ struct Srv2Db_CsrAcctInfoRequest : SrvMsgHeader {
}; };
struct Srv2Db_FetchInviterInfo : SrvMsgHeader { struct Srv2Db_FetchInviterInfo : SrvMsgHeader {
Uuid inviteUuid; plUUID inviteUuid;
}; };
@ -427,16 +427,16 @@ struct Db2Srv_AccountExistsReply : SrvMsgHeader {
}; };
struct Db2Srv_AccountCreateReply : SrvMsgHeader { struct Db2Srv_AccountCreateReply : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
}; };
struct Db2Srv_AccountCreateFromKeyReply : SrvMsgHeader { struct Db2Srv_AccountCreateFromKeyReply : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
Uuid activationKey; plUUID activationKey;
}; };
struct Db2Srv_AccountLoginReply : SrvMsgHeader { struct Db2Srv_AccountLoginReply : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
uint32_t accountFlags; uint32_t accountFlags;
uint32_t billingType; uint32_t billingType;
ShaDigest namePassHash; ShaDigest namePassHash;
@ -470,12 +470,12 @@ struct Db2Srv_SetAgeSequenceNumReply : SrvMsgHeader {
}; };
struct Db2Srv_FetchInviterInfoReply : SrvMsgHeader { struct Db2Srv_FetchInviterInfoReply : SrvMsgHeader {
Uuid hoodInstance; plUUID hoodInstance;
}; };
struct Db2Srv_StateObjectFetched : SrvMsgHeader { struct Db2Srv_StateObjectFetched : SrvMsgHeader {
uint32_t buildId; uint32_t buildId;
Uuid ownerId; plUUID ownerId;
wchar_t objectName[kMaxStateObjectName]; wchar_t objectName[kMaxStateObjectName];
uint32_t objectDataBytes; uint32_t objectDataBytes;
uint8_t objectData[1]; uint8_t objectData[1];
@ -484,7 +484,7 @@ struct Db2Srv_StateObjectFetched : SrvMsgHeader {
struct Db2Srv_NotifyVaultNodeChanged : SrvMsgHeader { struct Db2Srv_NotifyVaultNodeChanged : SrvMsgHeader {
uint32_t nodeId; uint32_t nodeId;
Uuid revId; plUUID revId;
uint32_t notifyIdCount; uint32_t notifyIdCount;
uint32_t notifyIds[1]; uint32_t notifyIds[1];
}; };
@ -545,7 +545,7 @@ struct Db2Srv_ScoreGetRanksReply : SrvMsgHeader {
}; };
struct Db2Srv_CsrAcctInfoReply : SrvMsgHeader { struct Db2Srv_CsrAcctInfoReply : SrvMsgHeader {
Uuid csrId; plUUID csrId;
uint32_t csrFlags; uint32_t csrFlags;
ShaDigest namePassHash; ShaDigest namePassHash;
}; };

30
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h

@ -125,8 +125,8 @@ struct Srv2Mcp_Connect {
struct Srv2Mcp_AgeJoinRequest : SrvMsgHeader { struct Srv2Mcp_AgeJoinRequest : SrvMsgHeader {
wchar_t ageName[kMaxAgeNameLength]; wchar_t ageName[kMaxAgeNameLength];
Uuid ageUuid; plUUID ageUuid;
Uuid accountUuid; plUUID accountUuid;
uint32_t playerInt; uint32_t playerInt;
uint8_t ccrLevel; uint8_t ccrLevel;
wchar_t playerName[kMaxPlayerNameLength]; wchar_t playerName[kMaxPlayerNameLength];
@ -135,21 +135,21 @@ struct Srv2Mcp_AgeJoinRequest : SrvMsgHeader {
struct Srv2Mcp_PlayerLoggedIn : SrvMsgHeader { struct Srv2Mcp_PlayerLoggedIn : SrvMsgHeader {
uint32_t ageMcpId; uint32_t ageMcpId;
Uuid ageUuid; plUUID ageUuid;
Uuid accountUuid; plUUID accountUuid;
wchar_t playerName[kMaxPlayerNameLength]; wchar_t playerName[kMaxPlayerNameLength];
uint32_t playerInt; uint32_t playerInt;
}; };
struct Srv2Mcp_PlayerLoggedOut : SrvMsgHeader { struct Srv2Mcp_PlayerLoggedOut : SrvMsgHeader {
uint32_t ageMcpId; uint32_t ageMcpId;
Uuid accountUuid; plUUID accountUuid;
uint32_t playerInt; uint32_t playerInt;
}; };
struct Srv2Mcp_AgeSpawned : SrvMsgHeader { struct Srv2Mcp_AgeSpawned : SrvMsgHeader {
wchar_t ageName[kMaxAgeNameLength]; wchar_t ageName[kMaxAgeNameLength];
Uuid ageUuid; plUUID ageUuid;
uint32_t buildId; uint32_t buildId;
}; };
@ -159,15 +159,15 @@ struct Srv2Mcp_AgeDied : SrvMsgHeader {
struct Srv2Mcp_AccountLoginRequest : SrvMsgHeader { struct Srv2Mcp_AccountLoginRequest : SrvMsgHeader {
wchar_t accountName[kMaxAccountNameLength]; wchar_t accountName[kMaxAccountNameLength];
Uuid accountUuid; plUUID accountUuid;
}; };
struct Srv2Mcp_AccountLogout : SrvMsgHeader { struct Srv2Mcp_AccountLogout : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
}; };
struct Srv2Mcp_AccountSetPlayer : SrvMsgHeader { struct Srv2Mcp_AccountSetPlayer : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
uint32_t playerInt; uint32_t playerInt;
}; };
@ -192,14 +192,14 @@ struct Srv2Mcp_KickPlayer : SrvMsgHeader {
struct Mcp2Srv_AgeJoinReply : SrvMsgHeader { struct Mcp2Srv_AgeJoinReply : SrvMsgHeader {
uint32_t ageMcpId; uint32_t ageMcpId;
Uuid ageUuid; plUUID ageUuid;
uint32_t gameSrvNode; uint32_t gameSrvNode;
}; };
struct Mcp2Srv_AgeSpawnRequest : SrvMsgHeader { struct Mcp2Srv_AgeSpawnRequest : SrvMsgHeader {
wchar_t ageName[kMaxAgeNameLength]; wchar_t ageName[kMaxAgeNameLength];
uint32_t ageMcpId; uint32_t ageMcpId;
Uuid ageUuid; plUUID ageUuid;
uint32_t buildId; uint32_t buildId;
}; };
@ -209,15 +209,15 @@ struct Mcp2Srv_AgeUnspawn : SrvMsgHeader {
struct Mcp2Srv_AgeAddPlayerRequest : SrvMsgHeader { struct Mcp2Srv_AgeAddPlayerRequest : SrvMsgHeader {
uint32_t ageMcpId; uint32_t ageMcpId;
Uuid accountUuid; plUUID accountUuid;
uint32_t playerInt; uint32_t playerInt;
uint8_t ccrLevel; uint8_t ccrLevel;
wchar_t playerName[kMaxPlayerNameLength]; wchar_t playerName[kMaxPlayerNameLength];
}; };
struct Mcp2Srv_AgeRemovePlayerRequest : SrvMsgHeader { struct Mcp2Srv_AgeRemovePlayerRequest : SrvMsgHeader {
Uuid ageMcpId; plUUID ageMcpId;
Uuid accountUuid; plUUID accountUuid;
uint32_t playerInt; uint32_t playerInt;
}; };
@ -230,7 +230,7 @@ struct Mcp2Srv_AccountLoginReply : SrvMsgHeader {
}; };
struct Mcp2Srv_AccountNotifyKicked : SrvMsgHeader { struct Mcp2Srv_AccountNotifyKicked : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
uint32_t acctMcpId; uint32_t acctMcpId;
ENetError reason; ENetError reason;
}; };

6
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h

@ -95,12 +95,12 @@ struct Srv2State_Connect {
***/ ***/
struct Srv2State_FetchObject : SrvMsgHeader { struct Srv2State_FetchObject : SrvMsgHeader {
Uuid ownerId; plUUID ownerId;
wchar_t objectName[kMaxStateObjectName]; wchar_t objectName[kMaxStateObjectName];
}; };
struct Srv2State_SaveObject : SrvMsgHeader { struct Srv2State_SaveObject : SrvMsgHeader {
Uuid ownerId; plUUID ownerId;
wchar_t objectName[kMaxStateObjectName]; wchar_t objectName[kMaxStateObjectName];
uint32_t objectDataBytes; uint32_t objectDataBytes;
uint8_t objectData[1]; // objectData[objectDataBytes], actually uint8_t objectData[1]; // objectData[objectDataBytes], actually
@ -108,7 +108,7 @@ struct Srv2State_SaveObject : SrvMsgHeader {
}; };
struct Srv2State_DeleteObject : SrvMsgHeader { struct Srv2State_DeleteObject : SrvMsgHeader {
Uuid ownerId; plUUID ownerId;
wchar_t objectName[kMaxStateObjectName]; wchar_t objectName[kMaxStateObjectName];
}; };

60
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h

@ -169,7 +169,7 @@ struct Srv2Vault_Connect {
***/ ***/
struct Srv2Vault_PlayerCreateRequest : SrvMsgHeader { struct Srv2Vault_PlayerCreateRequest : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
wchar_t playerName[kMaxPlayerNameLength]; wchar_t playerName[kMaxPlayerNameLength];
wchar_t avatarShape[MAX_PATH]; wchar_t avatarShape[MAX_PATH];
wchar_t friendInvite[MAX_PATH]; wchar_t friendInvite[MAX_PATH];
@ -177,21 +177,21 @@ struct Srv2Vault_PlayerCreateRequest : SrvMsgHeader {
}; };
struct Srv2Vault_PlayerDeleteRequest : SrvMsgHeader { struct Srv2Vault_PlayerDeleteRequest : SrvMsgHeader {
Uuid accountId; plUUID accountId;
uint32_t playerId; uint32_t playerId;
}; };
struct Srv2Vault_UpgradeVisitorRequest : SrvMsgHeader { struct Srv2Vault_UpgradeVisitorRequest : SrvMsgHeader {
Uuid accountId; plUUID accountId;
uint32_t playerId; uint32_t playerId;
}; };
struct Srv2Vault_AccountLoginRequest : SrvMsgHeader { struct Srv2Vault_AccountLoginRequest : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
}; };
struct Srv2Vault_AccountLogout : SrvMsgHeader { struct Srv2Vault_AccountLogout : SrvMsgHeader {
Uuid accountUuid; plUUID accountUuid;
}; };
struct Srv2Vault_FetchChildNodeRefs : SrvMsgHeader { struct Srv2Vault_FetchChildNodeRefs : SrvMsgHeader {
@ -204,7 +204,7 @@ struct Srv2Vault_NodeFetch : SrvMsgHeader {
}; };
struct Srv2Vault_CreateNodeRequest : SrvMsgHeader { struct Srv2Vault_CreateNodeRequest : SrvMsgHeader {
Uuid accountId; plUUID accountId;
uint32_t creatorId; uint32_t creatorId;
uint32_t nodeBytes; uint32_t nodeBytes;
uint8_t nodeBuffer[1]; uint8_t nodeBuffer[1];
@ -220,7 +220,7 @@ struct Srv2Vault_NodeSave : SrvMsgHeader {
uint32_t nodeId; uint32_t nodeId;
unsigned playerCheckId; unsigned playerCheckId;
unsigned isRequestFromAuth; unsigned isRequestFromAuth;
Uuid revisionId; plUUID revisionId;
uint32_t nodeBytes; uint32_t nodeBytes;
uint8_t nodeBuffer[1]; uint8_t nodeBuffer[1];
}; };
@ -229,7 +229,7 @@ struct Srv2Vault_NodeSave2 : SrvMsgHeader {
uint32_t nodeId; uint32_t nodeId;
unsigned playerCheckId; unsigned playerCheckId;
unsigned isRequestFromAuth; unsigned isRequestFromAuth;
Uuid revisionId; plUUID revisionId;
uint32_t nodeBytes; uint32_t nodeBytes;
uint8_t nodeBuffer[1]; uint8_t nodeBuffer[1];
}; };
@ -270,28 +270,28 @@ struct Srv2Vault_SendNode : SrvMsgHeader {
}; };
struct Srv2Vault_RegisterPlayerVault : SrvMsgHeader { struct Srv2Vault_RegisterPlayerVault : SrvMsgHeader {
Uuid accountId; plUUID accountId;
uint32_t playerId; uint32_t playerId;
}; };
struct Srv2Vault_UnregisterPlayerVault : SrvMsgHeader { struct Srv2Vault_UnregisterPlayerVault : SrvMsgHeader {
Uuid accountId; plUUID accountId;
}; };
struct Srv2Vault_RegisterAgeVault : SrvMsgHeader { struct Srv2Vault_RegisterAgeVault : SrvMsgHeader {
Uuid accountId; plUUID accountId;
uint32_t ageId; // age's vault node id uint32_t ageId; // age's vault node id
}; };
struct Srv2Vault_UnregisterAgeVault : SrvMsgHeader { struct Srv2Vault_UnregisterAgeVault : SrvMsgHeader {
Uuid accountId; plUUID accountId;
}; };
struct Srv2Vault_AgeInitRequest : SrvMsgHeader { struct Srv2Vault_AgeInitRequest : SrvMsgHeader {
Uuid accountId; plUUID accountId;
uint32_t playerId; uint32_t playerId;
Uuid ageInstId; plUUID ageInstId;
Uuid parentAgeInstId; plUUID parentAgeInstId;
uint32_t ageLanguage; uint32_t ageLanguage;
uint32_t ageSequenceNumber; uint32_t ageSequenceNumber;
// packed fields: // packed fields:
@ -318,24 +318,24 @@ struct Srv2Vault_CurrentPopulationReply : SrvMsgHeader {
}; };
struct Srv2Vault_ChangePlayerNameRequest : SrvMsgHeader { struct Srv2Vault_ChangePlayerNameRequest : SrvMsgHeader {
Uuid accountId; plUUID accountId;
uint32_t playerId; uint32_t playerId;
wchar_t newName[kMaxPlayerNameLength]; wchar_t newName[kMaxPlayerNameLength];
}; };
struct Srv2Vault_AccountOnline : SrvMsgHeader { struct Srv2Vault_AccountOnline : SrvMsgHeader {
Uuid acctId; plUUID acctId;
uint32_t buildId; uint32_t buildId;
uint32_t authNode; uint32_t authNode;
}; };
struct Srv2Vault_AccountOffline : SrvMsgHeader { struct Srv2Vault_AccountOffline : SrvMsgHeader {
Uuid acctId; plUUID acctId;
uint32_t buildId; uint32_t buildId;
}; };
struct Srv2Vault_PlayerOnline : SrvMsgHeader { struct Srv2Vault_PlayerOnline : SrvMsgHeader {
Uuid acctId; plUUID acctId;
uint32_t buildId; uint32_t buildId;
uint32_t playerId; uint32_t playerId;
}; };
@ -346,19 +346,19 @@ struct Srv2Vault_PlayerOffline : SrvMsgHeader {
}; };
struct Srv2Vault_AgeOnline : SrvMsgHeader { struct Srv2Vault_AgeOnline : SrvMsgHeader {
Uuid ageInstId; plUUID ageInstId;
uint32_t buildId; uint32_t buildId;
uint32_t gameNode; uint32_t gameNode;
}; };
struct Srv2Vault_AgeOffline : SrvMsgHeader { struct Srv2Vault_AgeOffline : SrvMsgHeader {
Uuid ageInstId; plUUID ageInstId;
uint32_t buildId; uint32_t buildId;
}; };
struct Srv2Vault_PlayerJoinedAge : SrvMsgHeader { struct Srv2Vault_PlayerJoinedAge : SrvMsgHeader {
uint32_t playerId; uint32_t playerId;
Uuid ageInstId; plUUID ageInstId;
uint32_t buildId; uint32_t buildId;
}; };
@ -400,24 +400,24 @@ struct Vault2Srv_NodeCreated : SrvMsgHeader {
struct Vault2Srv_NodeChanged : SrvMsgHeader { struct Vault2Srv_NodeChanged : SrvMsgHeader {
uint32_t nodeId; uint32_t nodeId;
Uuid revisionId; plUUID revisionId;
Uuid accountId; // the notify target plUUID accountId; // the notify target
}; };
struct Vault2Srv_NodeAdded : SrvMsgHeader { struct Vault2Srv_NodeAdded : SrvMsgHeader {
NetVaultNodeRef ref; NetVaultNodeRef ref;
Uuid accountId; // the notify target plUUID accountId; // the notify target
}; };
struct Vault2Srv_NodeRemoved : SrvMsgHeader { struct Vault2Srv_NodeRemoved : SrvMsgHeader {
uint32_t parentId; uint32_t parentId;
uint32_t childId; uint32_t childId;
Uuid accountId; // the notify target plUUID accountId; // the notify target
}; };
struct Vault2Srv_NodeDeleted : SrvMsgHeader { struct Vault2Srv_NodeDeleted : SrvMsgHeader {
uint32_t nodeId; uint32_t nodeId;
Uuid accountId; // the notify target plUUID accountId; // the notify target
}; };
struct Vault2Srv_NodeFindReply : SrvMsgHeader { struct Vault2Srv_NodeFindReply : SrvMsgHeader {
@ -430,7 +430,7 @@ struct Vault2Srv_NodeFindReply : SrvMsgHeader {
struct Vault2Srv_AgeInitReply : SrvMsgHeader { struct Vault2Srv_AgeInitReply : SrvMsgHeader {
uint32_t ageNodeId; uint32_t ageNodeId;
uint32_t ageInfoNodeId; uint32_t ageInfoNodeId;
Uuid accountId; // the requestor plUUID accountId; // the requestor
}; };
struct Vault2Srv_PublicAgeList : SrvMsgHeader { struct Vault2Srv_PublicAgeList : SrvMsgHeader {
@ -441,12 +441,12 @@ struct Vault2Srv_PublicAgeList : SrvMsgHeader {
struct Vault2Srv_NotifyAgeSDLChanged : SrvMsgHeader { struct Vault2Srv_NotifyAgeSDLChanged : SrvMsgHeader {
wchar_t ageName[kMaxAgeNameLength]; wchar_t ageName[kMaxAgeNameLength];
Uuid ageInstId; plUUID ageInstId;
}; };
struct Vault2Srv_CurrentPopulationRequest : SrvMsgHeader { struct Vault2Srv_CurrentPopulationRequest : SrvMsgHeader {
uint32_t ageCount; uint32_t ageCount;
Uuid ageInstIds[1]; // [ageCount], actually plUUID ageInstIds[1]; // [ageCount], actually
// no more fields after var length alloc // no more fields after var length alloc
}; };

31
Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp

@ -46,6 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
***/ ***/
#include "../Pch.h" #include "../Pch.h"
#include "pnUUID/pnUUID.h"
#pragma hdrstop #pragma hdrstop
@ -599,8 +600,8 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
_ZERO(kCreateTime, IVaultNodeSetValue, createTime, (unsigned)0); _ZERO(kCreateTime, IVaultNodeSetValue, createTime, (unsigned)0);
_ZERO(kModifyTime, IVaultNodeSetValue, modifyTime, (unsigned)0); _ZERO(kModifyTime, IVaultNodeSetValue, modifyTime, (unsigned)0);
_ZEROSTRING(kCreateAgeName, IVaultNodeSetString, createAgeName, L""); _ZEROSTRING(kCreateAgeName, IVaultNodeSetString, createAgeName, L"");
_ZERO(kCreateAgeUuid, IVaultNodeSetValue, createAgeUuid, kNilGuid); _ZERO(kCreateAgeUuid, IVaultNodeSetValue, createAgeUuid, kNilUuid);
_ZERO(kCreatorAcct, IVaultNodeSetValue, creatorAcct, kNilGuid); _ZERO(kCreatorAcct, IVaultNodeSetValue, creatorAcct, kNilUuid);
_ZERO(kCreatorId, IVaultNodeSetValue, creatorId, (unsigned)0); _ZERO(kCreatorId, IVaultNodeSetValue, creatorId, (unsigned)0);
_ZERO(kNodeType, IVaultNodeSetValue, nodeType, (unsigned)0); _ZERO(kNodeType, IVaultNodeSetValue, nodeType, (unsigned)0);
_ZERO(kInt32_1, IVaultNodeSetValue, int32_1, (signed)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_2, IVaultNodeSetValue, uint32_2, (unsigned)0);
_ZERO(kUInt32_3, IVaultNodeSetValue, uint32_3, (unsigned)0); _ZERO(kUInt32_3, IVaultNodeSetValue, uint32_3, (unsigned)0);
_ZERO(kUInt32_4, IVaultNodeSetValue, uint32_4, (unsigned)0); _ZERO(kUInt32_4, IVaultNodeSetValue, uint32_4, (unsigned)0);
_ZERO(kUuid_1, IVaultNodeSetValue, uuid_1, kNilGuid); _ZERO(kUuid_1, IVaultNodeSetValue, uuid_1, kNilUuid);
_ZERO(kUuid_2, IVaultNodeSetValue, uuid_2, kNilGuid); _ZERO(kUuid_2, IVaultNodeSetValue, uuid_2, kNilUuid);
_ZERO(kUuid_3, IVaultNodeSetValue, uuid_3, kNilGuid); _ZERO(kUuid_3, IVaultNodeSetValue, uuid_3, kNilUuid);
_ZERO(kUuid_4, IVaultNodeSetValue, uuid_4, kNilGuid); _ZERO(kUuid_4, IVaultNodeSetValue, uuid_4, kNilUuid);
_ZEROSTRING(kString64_1, IVaultNodeSetString, string64_1, L""); _ZEROSTRING(kString64_1, IVaultNodeSetString, string64_1, L"");
_ZEROSTRING(kString64_2, IVaultNodeSetString, string64_2, L""); _ZEROSTRING(kString64_2, IVaultNodeSetString, string64_2, L"");
_ZEROSTRING(kString64_3, IVaultNodeSetString, string64_3, 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); IVaultNodeSetValue(kCreateAgeUuid, this, &createAgeUuid, v);
} }
//============================================================================ //============================================================================
void NetVaultNode::SetCreatorAcct (const Uuid & v) { void NetVaultNode::SetCreatorAcct (const plUUID& v) {
IVaultNodeSetValue(kCreatorAcct, this, &creatorAcct, 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); 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); 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); 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); IVaultNodeSetValue(kUuid_4, this, &uuid_4, v);
} }
@ -976,9 +977,9 @@ void NetVaultNodeFieldArray::GetFieldValueString_LCS (
case NetVaultNode::kUuid_2: case NetVaultNode::kUuid_2:
case NetVaultNode::kUuid_3: case NetVaultNode::kUuid_3:
case NetVaultNode::kUuid_4: { case NetVaultNode::kUuid_4: {
wchar_t tmp[64]; plString tmp = reinterpret_cast<plUUID*>(fieldAddr)->AsString();
GuidToHex(*(Uuid *)fieldAddr, tmp, arrsize(tmp));
StrPrintf(dst, dstChars, L"hextoraw('%s')", tmp); StrPrintf(dst, dstChars, L"hextoraw('%s')", tmp.c_str());
} }
break; break;

44
Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h

@ -50,6 +50,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif #endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPCOMMON_H #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 kNetMsgFieldAccountName = NET_MSG_FIELD_STRING(kMaxAccountNameLength);
const NetMsgField kNetMsgFieldPlayerName = NET_MSG_FIELD_STRING(kMaxPlayerNameLength); const NetMsgField kNetMsgFieldPlayerName = NET_MSG_FIELD_STRING(kMaxPlayerNameLength);
const NetMsgField kNetMsgFieldShaDigest = NET_MSG_FIELD_RAW_DATA(sizeof(ShaDigest)); 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 kNetMsgFieldTransId = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldTimeMs = NET_MSG_FIELD_DWORD(); const NetMsgField kNetMsgFieldTimeMs = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldENetError = NET_MSG_FIELD_DWORD(); const NetMsgField kNetMsgFieldENetError = NET_MSG_FIELD_DWORD();
@ -96,7 +98,7 @@ struct SrvPlayerInfo {
***/ ***/
struct NetAgeInfo { struct NetAgeInfo {
Uuid ageInstId; plUUID ageInstId;
wchar_t ageFilename[kMaxAgeNameLength]; wchar_t ageFilename[kMaxAgeNameLength];
wchar_t ageInstName[kMaxAgeNameLength]; wchar_t ageInstName[kMaxAgeNameLength];
wchar_t ageUserName[kMaxAgeNameLength]; wchar_t ageUserName[kMaxAgeNameLength];
@ -209,7 +211,7 @@ struct NetVaultNode : AtomicRef {
uint64_t fieldFlags; uint64_t fieldFlags;
uint64_t dirtyFlags; uint64_t dirtyFlags;
Uuid revisionId; plUUID revisionId;
// Treat these as read-only or node flag fields will become invalid // Treat these as read-only or node flag fields will become invalid
// Threaded apps: Must be accessed with node->critsect locked // Threaded apps: Must be accessed with node->critsect locked
@ -217,8 +219,8 @@ struct NetVaultNode : AtomicRef {
unsigned createTime; unsigned createTime;
unsigned modifyTime; unsigned modifyTime;
wchar_t * createAgeName; wchar_t * createAgeName;
Uuid createAgeUuid; plUUID createAgeUuid;
Uuid creatorAcct; // accountId of node creator plUUID creatorAcct; // accountId of node creator
unsigned creatorId; // playerId of node creator unsigned creatorId; // playerId of node creator
unsigned nodeType; unsigned nodeType;
int int32_1; int int32_1;
@ -229,10 +231,10 @@ struct NetVaultNode : AtomicRef {
unsigned uint32_2; unsigned uint32_2;
unsigned uint32_3; unsigned uint32_3;
unsigned uint32_4; unsigned uint32_4;
Uuid uuid_1; plUUID uuid_1;
Uuid uuid_2; plUUID uuid_2;
Uuid uuid_3; plUUID uuid_3;
Uuid uuid_4; plUUID uuid_4;
wchar_t * string64_1; wchar_t * string64_1;
wchar_t * string64_2; wchar_t * string64_2;
wchar_t * string64_3; wchar_t * string64_3;
@ -261,8 +263,8 @@ struct NetVaultNode : AtomicRef {
void SetCreateTime (unsigned v); void SetCreateTime (unsigned v);
void SetModifyTime (unsigned v); void SetModifyTime (unsigned v);
void SetCreateAgeName (const wchar_t v[]); void SetCreateAgeName (const wchar_t v[]);
void SetCreateAgeUuid (const Uuid & v); void SetCreateAgeUuid (const plUUID& v);
void SetCreatorAcct (const Uuid & v); void SetCreatorAcct (const plUUID& v);
void SetCreatorId (unsigned v); void SetCreatorId (unsigned v);
void SetNodeType (unsigned v); void SetNodeType (unsigned v);
void SetInt32_1 (int v); void SetInt32_1 (int v);
@ -273,10 +275,10 @@ struct NetVaultNode : AtomicRef {
void SetUInt32_2 (unsigned v); void SetUInt32_2 (unsigned v);
void SetUInt32_3 (unsigned v); void SetUInt32_3 (unsigned v);
void SetUInt32_4 (unsigned v); void SetUInt32_4 (unsigned v);
void SetUuid_1 (const Uuid & v); void SetUuid_1 (const plUUID& v);
void SetUuid_2 (const Uuid & v); void SetUuid_2 (const plUUID& v);
void SetUuid_3 (const Uuid & v); void SetUuid_3 (const plUUID& v);
void SetUuid_4 (const Uuid & v); void SetUuid_4 (const plUUID& v);
void SetString64_1 (const wchar_t v[]); void SetString64_1 (const wchar_t v[]);
void SetString64_2 (const wchar_t v[]); void SetString64_2 (const wchar_t v[]);
void SetString64_3 (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 GetCreateTime () const { return createTime; }
inline unsigned GetModifyTime () const { return modifyTime; } inline unsigned GetModifyTime () const { return modifyTime; }
inline wchar_t * GetCreateAgeName () const { return createAgeName; } inline wchar_t * GetCreateAgeName () const { return createAgeName; }
inline Uuid GetCreateAgeUuid () const { return createAgeUuid; } inline plUUID GetCreateAgeUuid () const { return createAgeUuid; }
inline Uuid GetCreatorAcct () const { return creatorAcct; } inline plUUID GetCreatorAcct () const { return creatorAcct; }
inline unsigned GetCreatorId () const { return creatorId; } inline unsigned GetCreatorId () const { return creatorId; }
inline unsigned GetNodeType () const { return nodeType; } inline unsigned GetNodeType () const { return nodeType; }
inline int GetInt32_1 () const { return int32_1; } 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_2 () const { return uint32_2; }
inline unsigned GetUInt32_3 () const { return uint32_3; } inline unsigned GetUInt32_3 () const { return uint32_3; }
inline unsigned GetUInt32_4 () const { return uint32_4; } inline unsigned GetUInt32_4 () const { return uint32_4; }
inline Uuid GetUuid_1 () const { return uuid_1; } inline plUUID GetUuid_1 () const { return uuid_1; }
inline Uuid GetUuid_2 () const { return uuid_2; } inline plUUID GetUuid_2 () const { return uuid_2; }
inline Uuid GetUuid_3 () const { return uuid_3; } inline plUUID GetUuid_3 () const { return uuid_3; }
inline Uuid GetUuid_4 () const { return uuid_4; } inline plUUID GetUuid_4 () const { return uuid_4; }
inline wchar_t * GetString64_1 () const { return string64_1; } inline wchar_t * GetString64_1 () const { return string64_1; }
inline wchar_t * GetString64_2 () const { return string64_2; } inline wchar_t * GetString64_2 () const { return string64_2; }
inline wchar_t * GetString64_3 () const { return string64_3; } inline wchar_t * GetString64_3 () const { return string64_3; }

6
Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt

@ -7,10 +7,12 @@ set(pnUUID_SOURCES
if(WIN32) if(WIN32)
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Win32.cpp) set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Win32.cpp)
else(WIN32)
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp)
endif(WIN32) endif(WIN32)
if(UNIX)
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp)
endif(UNIX)
set(pnUUID_HEADERS set(pnUUID_HEADERS
pnUUID.h pnUUID.h
) )

25
Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp

@ -42,6 +42,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnUUID.h" #include "pnUUID.h"
#include "hsStream.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() plUUID::plUUID()
{ {
Clear(); Clear();
@ -49,12 +53,7 @@ plUUID::plUUID()
plUUID::plUUID(const plString& s) plUUID::plUUID(const plString& s)
{ {
FromString( s ); FromString(s.c_str());
}
plUUID::plUUID( const char * s )
{
FromString( s );
} }
plUUID::plUUID(const plUUID& other) plUUID::plUUID(const plUUID& other)
@ -62,11 +61,6 @@ plUUID::plUUID( const plUUID & other )
CopyFrom(&other); CopyFrom(&other);
} }
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->LogSubStreamPushDesc("plUUID");
@ -78,14 +72,9 @@ 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; plString str;
ToString(str); ToString(str);
return str; return str;
} }
plUUID::operator Uuid () const {
Uuid uuid;
memcpy(uuid.data, fData, sizeof(uuid.data));
return uuid;
}

14
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 #define pnUUID_h_inc
#include "HeadSpin.h" #include "HeadSpin.h"
#include "pnUtils/pnUtUuid.h" #include "plString.h"
class hsStream; class hsStream;
class plString;
extern const class plUUID kNilUuid;
class plUUID class plUUID
{ {
@ -61,10 +62,9 @@ public:
}; };
plUUID(); plUUID();
plUUID( const char * s );
plUUID(const plString& s); plUUID(const plString& s);
plUUID(const plUUID& other); plUUID(const plUUID& other);
plUUID( const Uuid & uuid );
void Clear(); void Clear();
bool IsNull() const; bool IsNull() const;
bool IsSet() const { return !IsNull(); } bool IsSet() const { return !IsNull(); }
@ -78,7 +78,9 @@ public:
plString AsString() const; plString AsString() const;
void Read(hsStream* s); void Read(hsStream* s);
void Write(hsStream* s); void Write(hsStream* s);
operator plString ( void ) const { return AsString();}
operator bool () const { return !IsNull(); }
inline bool operator ! () const { return IsNull(); }
bool operator==(const plUUID& other) const { bool operator==(const plUUID& other) const {
return IsEqualTo(&other); return IsEqualTo(&other);
@ -89,7 +91,7 @@ public:
bool operator<(const plUUID& other) const { bool operator<(const plUUID& other) const {
return CompareTo(&other) == -1; return CompareTo(&other) == -1;
} }
operator Uuid () const; operator plString (void) const { return AsString(); }
static plUUID Generate(); static plUUID Generate();
}; };

21
Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp

@ -45,6 +45,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <uuid/uuid.h> #include <uuid/uuid.h>
// Check UUID size
static_assert(sizeof(plUUID) == sizeof(uuid_t), "plUUID and uuid_t types differ in size");
struct plUUIDHelper struct plUUIDHelper
{ {
static inline void CopyToPlasma( plUUID * dst, const uuid_t & src ) static inline void CopyToPlasma( plUUID * dst, const uuid_t & src )
@ -64,7 +67,6 @@ struct plUUIDHelper
void plUUID::Clear() void plUUID::Clear()
{ {
uuid_t g; uuid_t g;
plUUIDHelper::CopyToNative( g, this );
uuid_clear( g ); uuid_clear( g );
plUUIDHelper::CopyToPlasma( this, g ); plUUIDHelper::CopyToPlasma( this, g );
} }
@ -98,10 +100,15 @@ bool plUUID::IsEqualTo( const plUUID * v ) const
bool plUUID::FromString( const char * str ) bool plUUID::FromString( const char * str )
{ {
Clear(); Clear();
if ( !str ) if (!str) {
return false; return false;
}
uuid_t g; uuid_t g;
uuid_parse( str, g ); if (uuid_parse(str, g) != 0) {
return false;
}
plUUIDHelper::CopyToPlasma(this, g); plUUIDHelper::CopyToPlasma(this, g);
return true; return true;
} }
@ -126,12 +133,4 @@ plUUID plUUID::Generate()
return result; 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 #endif

5
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 #ifdef HS_BUILD_FOR_WIN32
#include <rpc.h> #include <rpc.h>
// Check UUID size
static_assert(sizeof(plUUID) == sizeof(GUID), "plUUID and Win32 GUID types differ in size");
void plUUID::Clear() void plUUID::Clear()
{ {
UuidCreateNil( (GUID *)this ); UuidCreateNil( (GUID *)this );

4
Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt

@ -19,7 +19,6 @@ set(pnUtils_HEADERS
pnUtSort.h pnUtSort.h
pnUtStr.h pnUtStr.h
pnUtTime.h pnUtTime.h
pnUtUuid.h
) )
set(pnUtils_SOURCES set(pnUtils_SOURCES
@ -32,7 +31,6 @@ set(pnUtils_SOURCES
pnUtPath.cpp pnUtPath.cpp
pnUtStr.cpp pnUtStr.cpp
pnUtTime.cpp pnUtTime.cpp
pnUtUuid.cpp
) )
if(WIN32) if(WIN32)
@ -40,12 +38,10 @@ if(WIN32)
Win32/pnUtW32Misc.cpp Win32/pnUtW32Misc.cpp
Win32/pnUtW32Path.cpp Win32/pnUtW32Path.cpp
Win32/pnUtW32Str.cpp Win32/pnUtW32Str.cpp
Win32/pnUtW32Uuid.cpp
) )
else() else()
set(pnUtils_UNIX set(pnUtils_UNIX
Unix/pnUtUxStr.cpp Unix/pnUtUxStr.cpp
Unix/pnUtUxUuid.cpp
) )
endif() endif()

69
Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp

@ -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 <http://www.gnu.org/licenses/>.
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 <uuid/uuid.h>
COMPILER_ASSERT(sizeof(Uuid) >= sizeof(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

186
Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp

@ -1,186 +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 <http://www.gnu.org/licenses/>.
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 <rpc.h>
#include <rpcdce.h>
#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");
//============================================================================
Uuid GuidGenerate () {
Uuid result;
UuidCreate( (GUID *)&result );
return result;
}
//============================================================================
void GuidClear (Uuid * uuid) {
UuidCreateNil((GUID *)uuid);
}
//============================================================================
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 );
}
//============================================================================
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

1
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 "pnUtCoreLib.h" // must be first in list
#include "pnUtPragma.h" #include "pnUtPragma.h"
#include "pnUtUuid.h"
#include "pnUtSort.h" #include "pnUtSort.h"
#include "pnUtArray.h" #include "pnUtArray.h"
#include "pnUtList.h" #include "pnUtList.h"

106
Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp

@ -1,106 +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 <http://www.gnu.org/licenses/>.
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);
}
//============================================================================
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) {
ASSERT(length == sizeof(uuid->data));
memcpy(uuid->data, buf, sizeof(uuid->data));
return true;
}

118
Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h

@ -1,118 +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 <http://www.gnu.org/licenses/>.
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 =(
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);
/*****************************************************************************
*
* Uuid
*
***/
#pragma pack(push, 1)
struct Uuid {
union {
uint32_t uint32_ts[4];
uint8_t data[16];
};
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; }
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

4
Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp

@ -833,7 +833,7 @@ void plSceneInputInterface::ILinkOffereeToAge()
else if (!VaultGetOwnedAgeLink(&info, &link)) { else if (!VaultGetOwnedAgeLink(&info, &link)) {
// We must have an owned copy of the age before we can offer it, so make one now // 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); info.SetAgeInstanceGuid(&guid);
plString title, desc; plString title, desc;
@ -861,7 +861,7 @@ void plSceneInputInterface::ILinkOffereeToAge()
VaultAgeLinkNode linkAcc(linkNode); VaultAgeLinkNode linkAcc(linkNode);
if (linkAcc.volat) { if (linkAcc.volat) {
if (VaultUnregisterOwnedAgeAndWait(link.GetAgeInfo())) { if (VaultUnregisterOwnedAgeAndWait(link.GetAgeInfo())) {
plUUID guid(GuidGenerate()); plUUID guid = plUUID::Generate();
link.GetAgeInfo()->SetAgeInstanceGuid(&guid); link.GetAgeInfo()->SetAgeInstanceGuid(&guid);
VaultRegisterOwnedAgeAndWait(&link); VaultRegisterOwnedAgeAndWait(&link);
} }

14
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

@ -419,7 +419,7 @@ void plNetLinkingMgr::IDoLink(plLinkToAgeMsg* msg)
// Queue join op // Queue join op
NlmJoinAgeOp * joinAgeOp = NEWZERO(NlmJoinAgeOp); NlmJoinAgeOp * joinAgeOp = NEWZERO(NlmJoinAgeOp);
joinAgeOp->age.ageInstId = (Uuid) *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid(); joinAgeOp->age.ageInstId = *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid();
StrCopy( StrCopy(
joinAgeOp->age.ageDatasetName, joinAgeOp->age.ageDatasetName,
GetAgeLink()->GetAgeInfo()->GetAgeFilename(), GetAgeLink()->GetAgeInfo()->GetAgeFilename(),
@ -768,7 +768,7 @@ void plNetLinkingMgr::IPostProcessLink( void )
if (RelVaultNode* rvnInfo = VaultGetPlayerInfoNodeIncRef()) { if (RelVaultNode* rvnInfo = VaultGetPlayerInfoNodeIncRef()) {
VaultPlayerInfoNode accInfo(rvnInfo); VaultPlayerInfoNode accInfo(rvnInfo);
wchar_t ageInstName[MAX_PATH]; wchar_t ageInstName[MAX_PATH];
Uuid ageInstGuid = *info->GetAgeInstanceGuid(); plUUID ageInstGuid = *info->GetAgeInstanceGuid();
StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName)); StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName));
accInfo.SetAgeInstName(ageInstName); accInfo.SetAgeInstName(ageInstName);
accInfo.SetAgeInstUuid(ageInstGuid); accInfo.SetAgeInstUuid(ageInstGuid);
@ -863,7 +863,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
if (RelVaultNode * rvnInfo = VaultGetPlayerInfoNodeIncRef()) { if (RelVaultNode * rvnInfo = VaultGetPlayerInfoNodeIncRef()) {
VaultPlayerInfoNode accInfo(rvnInfo); VaultPlayerInfoNode accInfo(rvnInfo);
accInfo.SetAgeInstName(nil); accInfo.SetAgeInstName(nil);
accInfo.SetAgeInstUuid(kNilGuid); accInfo.SetAgeInstUuid(kNilUuid);
accInfo.SetOnline(false); accInfo.SetOnline(false);
rvnInfo->DecRef(); rvnInfo->DecRef();
} }
@ -872,7 +872,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
if (RelVaultNode * rvnInfo = VaultGetPlayerInfoNodeIncRef()) { if (RelVaultNode * rvnInfo = VaultGetPlayerInfoNodeIncRef()) {
VaultPlayerInfoNode accInfo(rvnInfo); VaultPlayerInfoNode accInfo(rvnInfo);
wchar_t ageInstName[MAX_PATH]; wchar_t ageInstName[MAX_PATH];
Uuid ageInstGuid = *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid(); plUUID ageInstGuid = *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid();
StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName)); StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName));
accInfo.SetAgeInstName(ageInstName); accInfo.SetAgeInstName(ageInstName);
accInfo.SetAgeInstUuid(ageInstGuid); accInfo.SetAgeInstUuid(ageInstGuid);
@ -920,7 +920,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
// BASIC LINK. Link to a unique instance of the age, if no instance specified. // BASIC LINK. Link to a unique instance of the age, if no instance specified.
case plNetCommon::LinkingRules::kBasicLink: case plNetCommon::LinkingRules::kBasicLink:
if (!info->HasAgeInstanceGuid()) { if (!info->HasAgeInstanceGuid()) {
plUUID newuuid(GuidGenerate()); plUUID newuuid = plUUID::Generate();
info->SetAgeInstanceGuid(&newuuid); info->SetAgeInstanceGuid(&newuuid);
} }
break; break;
@ -961,7 +961,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
info->SetAgeDescription(desc.c_str()); info->SetAgeDescription(desc.c_str());
} }
if (!info->HasAgeInstanceGuid()) { if (!info->HasAgeInstanceGuid()) {
plUUID newuuid(GuidGenerate()); plUUID newuuid = plUUID::Generate();
info->SetAgeInstanceGuid(&newuuid); info->SetAgeInstanceGuid(&newuuid);
} }
@ -1002,7 +1002,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
} }
if (!info->HasAgeInstanceGuid()) { if (!info->HasAgeInstanceGuid()) {
plUUID newuuid(GuidGenerate()); plUUID newuuid = plUUID::Generate();
info->SetAgeInstanceGuid(&newuuid); info->SetAgeInstanceGuid(&newuuid);
} }

29
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp

@ -121,7 +121,7 @@ static wchar_t s_iniAuthToken[kMaxPublisherAuthKeyLength];
static wchar_t s_iniOS[kMaxGTOSIdLength]; static wchar_t s_iniOS[kMaxGTOSIdLength];
static bool s_iniReadAccountInfo = true; static bool s_iniReadAccountInfo = true;
static wchar_t s_iniStartupAgeName[kMaxAgeNameLength]; static wchar_t s_iniStartupAgeName[kMaxAgeNameLength];
static Uuid s_iniStartupAgeInstId; static plUUID s_iniStartupAgeInstId;
static wchar_t s_iniStartupPlayerName[kMaxPlayerNameLength]; static wchar_t s_iniStartupPlayerName[kMaxPlayerNameLength];
static bool s_netError = false; static bool s_netError = false;
@ -382,7 +382,7 @@ static void INetCliAuthLoginSetPlayerRequestCallback (
static void INetCliAuthLoginRequestCallback ( static void INetCliAuthLoginRequestCallback (
ENetError result, ENetError result,
void * param, void * param,
const Uuid & accountUuid, const plUUID& accountUuid,
unsigned accountFlags, unsigned accountFlags,
unsigned billingType, unsigned billingType,
const NetCliAuthPlayerInfo playerInfoArr[], const NetCliAuthPlayerInfo playerInfoArr[],
@ -417,7 +417,7 @@ static void INetCliAuthLoginRequestCallback (
} }
} }
else else
s_account.accountUuid = kNilGuid; s_account.accountUuid = kNilUuid;
// If they specified an alternate age, but we couldn't find the player, force // 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. // the StartUp age to load so that they may select/create a player first.
@ -590,20 +590,23 @@ static void INetCliAuthAgeRequestCallback (
void * param, void * param,
unsigned ageMcpId, unsigned ageMcpId,
unsigned ageVaultId, unsigned ageVaultId,
const Uuid & ageInstId, const plUUID& ageInstId,
plNetAddress gameAddr plNetAddress gameAddr
) { ) {
if (!IS_NET_ERROR(result) || result == kNetErrVaultNodeNotFound) { if (!IS_NET_ERROR(result) || result == kNetErrVaultNodeNotFound) {
s_age.ageInstId = ageInstId; s_age.ageInstId = ageInstId;
s_age.ageVaultId = ageVaultId; s_age.ageVaultId = ageVaultId;
wchar_t ageInstIdStr[64]; plString gameAddrStr = gameAddr.GetHostString();
plString ageInstIdStr = ageInstId.AsString();
LogMsg( LogMsg(
kLogPerf, kLogPerf,
L"Connecting to game server %s, ageInstId %s", L"Connecting to game server %s, ageInstId %s",
gameAddr.GetHostString().ToWchar().GetData(), gameAddrStr.c_str(),
GuidToString(ageInstId, ageInstIdStr, arrsize(ageInstIdStr)) ageInstIdStr.c_str()
); );
NetCliGameDisconnect(); NetCliGameDisconnect();
NetCliGameStartConnect(gameAddr.GetHost()); NetCliGameStartConnect(gameAddr.GetHost());
NetCliGameJoinAgeRequest( NetCliGameJoinAgeRequest(
@ -1118,7 +1121,7 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg
if (RelVaultNode* rvn = VaultGetPlayerInfoNodeIncRef()) { if (RelVaultNode* rvn = VaultGetPlayerInfoNodeIncRef()) {
VaultPlayerInfoNode pInfo(rvn); VaultPlayerInfoNode pInfo(rvn);
pInfo.SetAgeInstName(nil); pInfo.SetAgeInstName(nil);
pInfo.SetAgeInstUuid(kNilGuid); pInfo.SetAgeInstUuid(kNilUuid);
pInfo.SetOnline(false); pInfo.SetOnline(false);
NetCliAuthVaultNodeSave(rvn, nil, nil); NetCliAuthVaultNodeSave(rvn, nil, nil);
@ -1242,14 +1245,14 @@ void NetCommSetAgePublic ( // --> no msg
//============================================================================ //============================================================================
void NetCommCreatePublicAge (// --> plNetCommPublicAgeMsg void NetCommCreatePublicAge (// --> plNetCommPublicAgeMsg
const char ageName[], const char ageName[],
const Uuid & ageInstId, const plUUID& ageInstId,
void * param void * param
) { ) {
} }
//============================================================================ //============================================================================
void NetCommRemovePublicAge(// --> plNetCommPublicAgeMsg void NetCommRemovePublicAge(// --> plNetCommPublicAgeMsg
const Uuid & ageInstId, const plUUID& ageInstId,
void * param void * param
) { ) {
} }
@ -1282,7 +1285,7 @@ void NetCommRegisterVisitAge (
//============================================================================ //============================================================================
void NetCommUnregisterVisitAge ( void NetCommUnregisterVisitAge (
const Uuid & ageInstId, const plUUID& ageInstId,
unsigned playerInt, unsigned playerInt,
void * param void * param
) { ) {
@ -1296,7 +1299,7 @@ void NetCommConnectPlayerVault (
//============================================================================ //============================================================================
void NetCommConnectAgeVault ( void NetCommConnectAgeVault (
const Uuid & ageInstId, const plUUID& ageInstId,
void * param void * param
) { ) {
} }
@ -1330,7 +1333,7 @@ void NetCommSetCCRLevel (
void NetCommSendFriendInvite ( void NetCommSendFriendInvite (
const wchar_t emailAddress[], const wchar_t emailAddress[],
const wchar_t toName[], const wchar_t toName[],
const Uuid& inviteUuid const plUUID& inviteUuid
) { ) {
NetCliAuthSendFriendInvite( NetCliAuthSendFriendInvite(
emailAddress, emailAddress,

14
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h

@ -79,7 +79,7 @@ struct NetCommPlayer {
}; };
struct NetCommAccount { struct NetCommAccount {
Uuid accountUuid; plUUID accountUuid;
wchar_t accountName[kMaxAccountNameLength]; wchar_t accountName[kMaxAccountNameLength];
ShaDigest accountNamePassHash; ShaDigest accountNamePassHash;
char accountNameAnsi[kMaxAccountNameLength]; char accountNameAnsi[kMaxAccountNameLength];
@ -88,7 +88,7 @@ struct NetCommAccount {
}; };
struct NetCommAge { struct NetCommAge {
Uuid ageInstId; plUUID ageInstId;
unsigned ageVaultId; unsigned ageVaultId;
char ageDatasetName[kMaxAgeNameLength]; char ageDatasetName[kMaxAgeNameLength];
char spawnPtName[64]; char spawnPtName[64];
@ -232,11 +232,11 @@ void NetCommSetAgePublic ( // --> no msg
); );
void NetCommCreatePublicAge (// --> plNetCommPublicAgeMsg void NetCommCreatePublicAge (// --> plNetCommPublicAgeMsg
const char ageName[], const char ageName[],
const Uuid & ageInstId, const plUUID& ageInstId,
void * param void * param
); );
void NetCommRemovePublicAge(// --> plNetCommPublicAgeMsg void NetCommRemovePublicAge(// --> plNetCommPublicAgeMsg
const Uuid & ageInstId, const plUUID& ageInstId,
void * param void * param
); );
void NetCommRegisterOwnedAge ( void NetCommRegisterOwnedAge (
@ -257,7 +257,7 @@ void NetCommRegisterVisitAge (
void * param void * param
); );
void NetCommUnregisterVisitAge ( void NetCommUnregisterVisitAge (
const Uuid & ageInstId, const plUUID& ageInstId,
unsigned playerInt, unsigned playerInt,
void * param void * param
); );
@ -266,7 +266,7 @@ void NetCommConnectPlayerVault (
); );
void NetCommDisconnectPlayerVault (); void NetCommDisconnectPlayerVault ();
void NetCommConnectAgeVault ( void NetCommConnectAgeVault (
const Uuid & ageInstId, const plUUID& ageInstId,
void * param void * param
); );
void NetCommDisconnectAgeVault (); void NetCommDisconnectAgeVault ();
@ -280,7 +280,7 @@ void NetCommSetCCRLevel (
void NetCommSendFriendInvite ( void NetCommSendFriendInvite (
const wchar_t emailAddress[], const wchar_t emailAddress[],
const wchar_t toName[], const wchar_t toName[],
const Uuid& inviteUuid const plUUID& inviteUuid
); );
#endif // PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETCLIENTCOMM_PLNETCLIENTCOMM_H #endif // PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETCLIENTCOMM_PLNETCLIENTCOMM_H

1
Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp

@ -39,6 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021 Mead, WA 99021
*==LICENSE==*/ *==LICENSE==*/
#include "hsWindows.h"
#include "plNetClientRecorder.h" #include "plNetClientRecorder.h"
#include "hsStream.h" #include "hsStream.h"
#include "hsTimer.h" #include "hsTimer.h"

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save