mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-13 18:17:49 -04:00
Replace Uuid with plUUID EVERYWHERE.
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user