2
3
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:
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

@ -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);
}
}