2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 10:37:41 -04:00

Replace Uuid with plUUID EVERYWHERE.

This commit is contained in:
Darryl Pogue
2012-12-29 02:05:23 -08:00
parent a0641ba66b
commit bcf6e97d23
78 changed files with 427 additions and 892 deletions

View File

@ -59,9 +59,9 @@ pyBlueSpiralGame::pyBlueSpiralGame(pfGameCli* client): pyGameCli(client)
gameClient = nil; // wrong type, just clear it out
}
bool pyBlueSpiralGame::IsBlueSpiralGame(std::wstring guid)
bool pyBlueSpiralGame::IsBlueSpiralGame(plString& guid)
{
Uuid gameUuid(guid.c_str());
plUUID gameUuid(guid);
return gameUuid == kGameTypeId_BlueSpiral;
}
@ -87,4 +87,4 @@ void pyBlueSpiralGame::HitCloth(int clothNum)
pfGmBlueSpiral* blueSpiral = pfGmBlueSpiral::ConvertNoRef(gameClient);
blueSpiral->HitCloth(clothNum);
}
}
}

View File

@ -68,7 +68,7 @@ public:
static void AddPlasmaClasses(PyObject* m);
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);
void StartGame();

View File

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsBlueSpiralGame, args, "Params: typeID\nRetur
PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &textObj))
{
PyErr_SetString(PyExc_TypeError, "PtIsBlueSpiralGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsBlueSpiralGame expects a string");
PYTHON_RETURN_ERROR;
}
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{
int strLen = PyUnicode_GetSize(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
plString text = PyString_AsStringEx(textObj);
bool retVal = pyBlueSpiralGame::IsBlueSpiralGame(text);
delete [] text;
PYTHON_RETURN_BOOL(retVal);
}
else if (PyString_Check(textObj))
{
// we'll allow this, just in case something goes weird
char* text = PyString_AsString(textObj);
wchar_t* wText = hsStringToWString(text);
bool retVal = pyBlueSpiralGame::IsBlueSpiralGame(wText);
delete [] wText;
PYTHON_RETURN_BOOL(retVal);
}
else
{
PyErr_SetString(PyExc_TypeError, "PtIsBlueSpiralGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsBlueSpiralGame expects a string");
PYTHON_RETURN_ERROR;
}
}
@ -159,4 +148,4 @@ void pyBlueSpiralGame::AddPlasmaMethods(std::vector<PyMethodDef>& methods)
{
PYTHON_GLOBAL_METHOD(methods, PtIsBlueSpiralGame);
PYTHON_GLOBAL_METHOD(methods, PtJoinCommonBlueSpiralGame);
}
}

View File

@ -59,9 +59,9 @@ pyClimbingWallGame::pyClimbingWallGame(pfGameCli* client): pyGameCli(client)
gameClient = nil; // wrong type, just clear it out
}
bool pyClimbingWallGame::IsClimbingWallGame(std::wstring guid)
bool pyClimbingWallGame::IsClimbingWallGame(plString& guid)
{
Uuid gameUuid(guid.c_str());
plUUID gameUuid(guid);
return gameUuid == kGameTypeId_ClimbingWall;
}
@ -132,4 +132,4 @@ void pyClimbingWallGame::Panic()
pfGmClimbingWall* climbingWall = pfGmClimbingWall::ConvertNoRef(gameClient);
climbingWall->Panic();
}
}
}

View File

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

View File

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsClimbingWallGame, args, "Params: typeID\nRet
PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &textObj))
{
PyErr_SetString(PyExc_TypeError, "PtIsClimbingWallGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsClimbingWallGame expects a string");
PYTHON_RETURN_ERROR;
}
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{
int strLen = PyUnicode_GetSize(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
plString text = PyString_AsStringEx(textObj);
bool retVal = pyClimbingWallGame::IsClimbingWallGame(text);
delete [] text;
PYTHON_RETURN_BOOL(retVal);
}
else if (PyString_Check(textObj))
{
// we'll allow this, just in case something goes weird
char* text = PyString_AsString(textObj);
wchar_t* wText = hsStringToWString(text);
bool retVal = pyClimbingWallGame::IsClimbingWallGame(wText);
delete [] wText;
PYTHON_RETURN_BOOL(retVal);
}
else
{
PyErr_SetString(PyExc_TypeError, "PtIsClimbingWallGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsClimbingWallGame expects a string");
PYTHON_RETURN_ERROR;
}
}
@ -213,4 +202,4 @@ void pyClimbingWallGame::AddPlasmaConstantsClasses(PyObject* m)
PYTHON_ENUM_ELEMENT(PtClimbingWallReadyTypes, kClimbingWallReadyNumBlockers, kClimbingWallReadyNumBlockers);
PYTHON_ENUM_ELEMENT(PtClimbingWallReadyTypes, kClimbingWallReadyBlockers, kClimbingWallReadyBlockers);
PYTHON_ENUM_END(m, PtClimbingWallReadyTypes);
}
}

View File

@ -59,9 +59,9 @@ pyHeekGame::pyHeekGame(pfGameCli* client): pyGameCli(client)
gameClient = nil; // wrong type, just clear it out
}
bool pyHeekGame::IsHeekGame(std::wstring guid)
bool pyHeekGame::IsHeekGame(plString& guid)
{
Uuid gameUuid(guid.c_str());
plUUID gameUuid(guid);
return gameUuid == kGameTypeId_Heek;
}
@ -104,4 +104,4 @@ void pyHeekGame::SequenceFinished(int seq)
pfGmHeek* heek = pfGmHeek::ConvertNoRef(gameClient);
heek->SequenceFinished((EHeekSeqFinished)seq);
}
}
}

View File

@ -69,7 +69,7 @@ public:
static void AddPlasmaConstantsClasses(PyObject* m);
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);
void PlayGame(int position, uint32_t points, std::wstring name);

View File

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsHeekGame, args, "Params: typeID\nReturns tru
PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &textObj))
{
PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a string");
PYTHON_RETURN_ERROR;
}
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{
int strLen = PyUnicode_GetSize(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
plString text = PyString_AsStringEx(textObj);
bool retVal = pyHeekGame::IsHeekGame(text);
delete [] text;
PYTHON_RETURN_BOOL(retVal);
}
else if (PyString_Check(textObj))
{
// we'll allow this, just in case something goes weird
char* text = PyString_AsString(textObj);
wchar_t* wText = hsStringToWString(text);
bool retVal = pyHeekGame::IsHeekGame(wText);
delete [] wText;
PYTHON_RETURN_BOOL(retVal);
}
else
{
PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsHeekGame expects a string");
PYTHON_RETURN_ERROR;
}
}
@ -224,4 +213,4 @@ void pyHeekGame::AddPlasmaMethods(std::vector<PyMethodDef>& methods)
{
PYTHON_GLOBAL_METHOD(methods, PtIsHeekGame);
PYTHON_GLOBAL_METHOD(methods, PtJoinCommonHeekGame);
}
}

View File

@ -60,9 +60,9 @@ pyMarkerGame::pyMarkerGame(pfGameCli* client): pyGameCli(client)
gameClient = nil; // wrong type, just clear it out
}
bool pyMarkerGame::IsMarkerGame(std::wstring guid)
bool pyMarkerGame::IsMarkerGame(plString& guid)
{
Uuid gameUuid(guid.c_str());
plUUID gameUuid(guid);
return gameUuid == kGameTypeId_Marker;
}
@ -164,4 +164,4 @@ void pyMarkerGame::CaptureMarker(unsigned long markerId)
pfGmMarker* marker = pfGmMarker::ConvertNoRef(gameClient);
marker->CaptureMarker(markerId);
}
}
}

View File

@ -69,7 +69,7 @@ public:
static void AddPlasmaConstantsClasses(PyObject* m);
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);
void StartGame();

View File

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsMarkerGame, args, "Params: typeID\nReturns t
PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &textObj))
{
PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a string");
PYTHON_RETURN_ERROR;
}
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{
int strLen = PyUnicode_GetSize(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
plString text = PyString_AsStringEx(textObj);
bool retVal = pyMarkerGame::IsMarkerGame(text);
delete [] text;
PYTHON_RETURN_BOOL(retVal);
}
else if (PyString_Check(textObj))
{
// we'll allow this, just in case something goes weird
char* text = PyString_AsString(textObj);
wchar_t* wText = hsStringToWString(text);
bool retVal = pyMarkerGame::IsMarkerGame(wText);
delete [] wText;
PYTHON_RETURN_BOOL(retVal);
}
else
{
PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsMarkerGame expects a string");
PYTHON_RETURN_ERROR;
}
}

View File

@ -59,9 +59,9 @@ pyTTTGame::pyTTTGame(pfGameCli* client): pyGameCli(client)
gameClient = nil; // wrong type, just clear it out
}
bool pyTTTGame::IsTTTGame(std::wstring guid)
bool pyTTTGame::IsTTTGame(plString& guid)
{
Uuid gameUuid(guid.c_str());
plUUID gameUuid(guid);
return gameUuid == kGameTypeId_TicTacToe;
}
@ -95,4 +95,4 @@ void pyTTTGame::ShowBoard()
pfGmTicTacToe* ttt = pfGmTicTacToe::ConvertNoRef(gameClient);
ttt->ShowBoard();
}
}
}

View File

@ -69,7 +69,7 @@ public:
static void AddPlasmaConstantsClasses(PyObject* m);
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 JoinCommonTTTGame(pyKey& callbackKey, unsigned gameID, unsigned numPlayers);

View File

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsTTTGame, args, "Params: typeID\nReturns true
PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &textObj))
{
PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a string");
PYTHON_RETURN_ERROR;
}
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{
int strLen = PyUnicode_GetSize(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
plString text = PyString_AsStringEx(textObj);
bool retVal = pyTTTGame::IsTTTGame(text);
delete [] text;
PYTHON_RETURN_BOOL(retVal);
}
else if (PyString_Check(textObj))
{
// we'll allow this, just in case something goes weird
char* text = PyString_AsString(textObj);
wchar_t* wText = hsStringToWString(text);
bool retVal = pyTTTGame::IsTTTGame(wText);
delete [] wText;
PYTHON_RETURN_BOOL(retVal);
}
else
{
PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a string");
PYTHON_RETURN_ERROR;
}
}
@ -189,4 +178,4 @@ void pyTTTGame::AddPlasmaMethods(std::vector<PyMethodDef>& methods)
PYTHON_GLOBAL_METHOD(methods, PtIsTTTGame);
PYTHON_GLOBAL_METHOD(methods, PtCreateTTTGame);
PYTHON_GLOBAL_METHOD(methods, PtJoinCommonTTTGame);
}
}

View File

@ -61,9 +61,9 @@ pyVarSyncGame::pyVarSyncGame(pfGameCli* client): pyGameCli(client)
gameClient = nil; // wrong type, just clear it out
}
bool pyVarSyncGame::IsVarSyncGame(std::wstring guid)
bool pyVarSyncGame::IsVarSyncGame(plString& guid)
{
Uuid gameUuid(guid.c_str());
plUUID gameUuid(guid);
return gameUuid == kGameTypeId_VarSync;
}
@ -117,4 +117,4 @@ void pyVarSyncGame::CreateNumericVar(std::wstring name, double val)
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
vsync->CreateNumericVar(name.c_str(), val);
}
}
}

View File

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

View File

@ -65,31 +65,20 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsVarSyncGame, args, "Params: typeID\nReturns
PyObject* textObj;
if (!PyArg_ParseTuple(args, "O", &textObj))
{
PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a string");
PYTHON_RETURN_ERROR;
}
if (PyUnicode_Check(textObj))
if (PyString_CheckEx(textObj))
{
int strLen = PyUnicode_GetSize(textObj);
wchar_t* text = new wchar_t[strLen + 1];
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
text[strLen] = L'\0';
plString text = PyString_AsStringEx(textObj);
bool retVal = pyVarSyncGame::IsVarSyncGame(text);
delete [] text;
PYTHON_RETURN_BOOL(retVal);
}
else if (PyString_Check(textObj))
{
// we'll allow this, just in case something goes weird
char* text = PyString_AsString(textObj);
wchar_t* wText = hsStringToWString(text);
bool retVal = pyVarSyncGame::IsVarSyncGame(wText);
delete [] wText;
PYTHON_RETURN_BOOL(retVal);
}
else
{
PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a unicode string");
PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a string");
PYTHON_RETURN_ERROR;
}
}
@ -325,4 +314,4 @@ void pyVarSyncGame::AddPlasmaMethods(std::vector<PyMethodDef>& methods)
{
PYTHON_GLOBAL_METHOD(methods, PtIsVarSyncGame);
PYTHON_GLOBAL_METHOD(methods, PtJoinCommonVarSyncGame);
}
}

View File

@ -106,7 +106,7 @@ plUUID pyGameCli::GameTypeID() const
{
return plUUID(gameClient->GetGameTypeId());
}
return plUUID();
return kNilUuid;
}
std::wstring pyGameCli::Name() const

View File

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

View File

@ -111,7 +111,7 @@ plUUID pyGameMgrInviteReceivedMsg::GameTypeID() const
const Srv2Cli_GameMgr_InviteReceived* gmMsg = (const Srv2Cli_GameMgr_InviteReceived*)message->netMsg;
return plUUID(gmMsg->gameTypeId);
}
return plUUID();
return kNilUuid;
}
uint32_t pyGameMgrInviteReceivedMsg::NewGameID() const
@ -150,7 +150,7 @@ plUUID pyGameMgrInviteRevokedMsg::GameTypeID() const
const Srv2Cli_GameMgr_InviteRevoked* gmMsg = (const Srv2Cli_GameMgr_InviteRevoked*)message->netMsg;
return plUUID(gmMsg->gameTypeId);
}
return plUUID();
return kNilUuid;
}
uint32_t pyGameMgrInviteRevokedMsg::NewGameID() const