mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-13 18:17:49 -04:00
Fix line endings and tabs
This commit is contained in:
@ -1,99 +1,99 @@
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#include "pyVarSyncGame.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base VarSync game client class
|
||||
//
|
||||
|
||||
const unsigned kGameId = 255; // random number that should be high enough to avoid collisions with other global games
|
||||
|
||||
pyVarSyncGame::pyVarSyncGame(): pyGameCli() {}
|
||||
|
||||
pyVarSyncGame::pyVarSyncGame(pfGameCli* client): pyGameCli(client)
|
||||
{
|
||||
if (client && (client->GetGameTypeId() != kGameTypeId_VarSync))
|
||||
gameClient = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
bool pyVarSyncGame::IsVarSyncGame(std::wstring guid)
|
||||
{
|
||||
Uuid gameUuid(guid.c_str());
|
||||
return gameUuid == kGameTypeId_VarSync;
|
||||
}
|
||||
|
||||
void pyVarSyncGame::JoinCommonVarSyncGame(pyKey& callbackKey)
|
||||
{
|
||||
// NOTE: We don't let the player specify the game ID, because there should only be one of these in an age, ever
|
||||
VarSync_CreateParam init;
|
||||
pfGameMgr::GetInstance()->JoinCommonGame(callbackKey.getKey(), kGameTypeId_VarSync, kGameId, sizeof(init), &init);
|
||||
}
|
||||
|
||||
void pyVarSyncGame::SetStringVar(unsigned long id, std::wstring val)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
|
||||
vsync->SetStringVar(id, val.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void pyVarSyncGame::SetNumericVar(unsigned long id, double val)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
|
||||
vsync->SetNumericVar(id, val);
|
||||
}
|
||||
}
|
||||
|
||||
void pyVarSyncGame::RequestAllVars()
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
|
||||
vsync->RequestAllVars();
|
||||
}
|
||||
}
|
||||
|
||||
void pyVarSyncGame::CreateStringVar(std::wstring name, std::wstring val)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
|
||||
vsync->CreateStringVar(name.c_str(), val.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void pyVarSyncGame::CreateNumericVar(std::wstring name, double val)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
|
||||
vsync->CreateNumericVar(name.c_str(), val);
|
||||
}
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#include "pyVarSyncGame.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base VarSync game client class
|
||||
//
|
||||
|
||||
const unsigned kGameId = 255; // random number that should be high enough to avoid collisions with other global games
|
||||
|
||||
pyVarSyncGame::pyVarSyncGame(): pyGameCli() {}
|
||||
|
||||
pyVarSyncGame::pyVarSyncGame(pfGameCli* client): pyGameCli(client)
|
||||
{
|
||||
if (client && (client->GetGameTypeId() != kGameTypeId_VarSync))
|
||||
gameClient = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
bool pyVarSyncGame::IsVarSyncGame(std::wstring guid)
|
||||
{
|
||||
Uuid gameUuid(guid.c_str());
|
||||
return gameUuid == kGameTypeId_VarSync;
|
||||
}
|
||||
|
||||
void pyVarSyncGame::JoinCommonVarSyncGame(pyKey& callbackKey)
|
||||
{
|
||||
// NOTE: We don't let the player specify the game ID, because there should only be one of these in an age, ever
|
||||
VarSync_CreateParam init;
|
||||
pfGameMgr::GetInstance()->JoinCommonGame(callbackKey.getKey(), kGameTypeId_VarSync, kGameId, sizeof(init), &init);
|
||||
}
|
||||
|
||||
void pyVarSyncGame::SetStringVar(unsigned long id, std::wstring val)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
|
||||
vsync->SetStringVar(id, val.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void pyVarSyncGame::SetNumericVar(unsigned long id, double val)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
|
||||
vsync->SetNumericVar(id, val);
|
||||
}
|
||||
}
|
||||
|
||||
void pyVarSyncGame::RequestAllVars()
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
|
||||
vsync->RequestAllVars();
|
||||
}
|
||||
}
|
||||
|
||||
void pyVarSyncGame::CreateStringVar(std::wstring name, std::wstring val)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
|
||||
vsync->CreateStringVar(name.c_str(), val.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void pyVarSyncGame::CreateNumericVar(std::wstring name, double val)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmVarSync* vsync = pfGmVarSync::ConvertNoRef(gameClient);
|
||||
vsync->CreateNumericVar(name.c_str(), val);
|
||||
}
|
||||
}
|
@ -1,69 +1,69 @@
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#ifndef pyVarSyncGame_h
|
||||
#define pyVarSyncGame_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: pyVarSyncGame
|
||||
//
|
||||
// PURPOSE: Class wrapper for the VarSync game client
|
||||
//
|
||||
|
||||
#include "pfGameMgr/pfGameMgr.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyGlueHelpers.h"
|
||||
#include "../pyGameCli.h"
|
||||
#include "../../pyKey.h"
|
||||
|
||||
class pyVarSyncGame : public pyGameCli
|
||||
{
|
||||
protected:
|
||||
pyVarSyncGame();
|
||||
pyVarSyncGame(pfGameCli* client);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncGame);
|
||||
static PyObject* New(pfGameCli* client);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncGame object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncGame); // converts a PyObject to a pyVarSyncGame (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
|
||||
|
||||
static bool IsVarSyncGame(std::wstring guid);
|
||||
static void JoinCommonVarSyncGame(pyKey& callbackKey);
|
||||
|
||||
void SetStringVar(unsigned long id, std::wstring val);
|
||||
void SetNumericVar(unsigned long id, double val);
|
||||
void RequestAllVars();
|
||||
void CreateStringVar(std::wstring name, std::wstring val);
|
||||
void CreateNumericVar(std::wstring name, double val);
|
||||
};
|
||||
|
||||
#endif // pyVarSyncGame_h
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#ifndef pyVarSyncGame_h
|
||||
#define pyVarSyncGame_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: pyVarSyncGame
|
||||
//
|
||||
// PURPOSE: Class wrapper for the VarSync game client
|
||||
//
|
||||
|
||||
#include "pfGameMgr/pfGameMgr.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyGlueHelpers.h"
|
||||
#include "../pyGameCli.h"
|
||||
#include "../../pyKey.h"
|
||||
|
||||
class pyVarSyncGame : public pyGameCli
|
||||
{
|
||||
protected:
|
||||
pyVarSyncGame();
|
||||
pyVarSyncGame(pfGameCli* client);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncGame);
|
||||
static PyObject* New(pfGameCli* client);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncGame object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncGame); // converts a PyObject to a pyVarSyncGame (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
|
||||
|
||||
static bool IsVarSyncGame(std::wstring guid);
|
||||
static void JoinCommonVarSyncGame(pyKey& callbackKey);
|
||||
|
||||
void SetStringVar(unsigned long id, std::wstring val);
|
||||
void SetNumericVar(unsigned long id, double val);
|
||||
void RequestAllVars();
|
||||
void CreateStringVar(std::wstring name, std::wstring val);
|
||||
void CreateNumericVar(std::wstring name, double val);
|
||||
};
|
||||
|
||||
#endif // pyVarSyncGame_h
|
||||
|
@ -1,308 +1,308 @@
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#include "pyVarSyncGame.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyEnum.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base VarSync game client class
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncGame, pyVarSyncGame);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncGame, pyVarSyncGame)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncGame)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncGame)
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtIsVarSyncGame, args, "Params: typeID\nReturns true if the specifed typeID (guid as a string) is a VarSync game")
|
||||
{
|
||||
PyObject* textObj;
|
||||
if (!PyArg_ParseTuple(args, "O", &textObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a unicode string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (PyUnicode_Check(textObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(textObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
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");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtJoinCommonVarSyncGame, args, "Params: callbackKey\nJoins the common VarSync game. If one doesn't exist, it creates it")
|
||||
{
|
||||
PyObject* callbackObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "O", &callbackObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtJoinCommonVarSyncGame expects a ptKey");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (!pyKey::Check(callbackObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtJoinCommonVarSyncGame expects a ptKey");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyKey* key = pyKey::ConvertFrom(callbackObj);
|
||||
pyVarSyncGame::JoinCommonVarSyncGame(*key);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptVarSyncGame, setStringVar, args)
|
||||
{
|
||||
unsigned long id;
|
||||
PyObject* valueObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "kO", &id, &valueObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "setStringVar expects an unsigned long and a string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (PyUnicode_Check(valueObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(valueObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)valueObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
self->fThis->SetStringVar(id, text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
else if (PyString_Check(valueObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(valueObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
self->fThis->SetStringVar(id, wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "setStringVar expects an unsigned long and a string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptVarSyncGame, setNumericVar, args)
|
||||
{
|
||||
unsigned long id;
|
||||
PyObject* valueObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "kO", &id, &valueObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "setNumericVar expects an unsigned long and a number");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
double val = 0;
|
||||
if (PyFloat_Check(valueObj))
|
||||
val = PyFloat_AsDouble(valueObj);
|
||||
else if (PyInt_Check(valueObj))
|
||||
val = (double)PyInt_AsLong(valueObj);
|
||||
else if (PyLong_Check(valueObj))
|
||||
val = PyLong_AsDouble(valueObj);
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "setNumericVar expects an unsigned long and a number");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
self->fThis->SetNumericVar(id, val);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_BASIC_METHOD_DEFINITION(ptVarSyncGame, requestAllVars, RequestAllVars)
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptVarSyncGame, createStringVar, args)
|
||||
{
|
||||
PyObject* varNameObj = NULL;
|
||||
PyObject* valueObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "OO", &varNameObj, &valueObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createStringVar expects two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
std::wstring varName = L"";
|
||||
if (PyUnicode_Check(varNameObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(varNameObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)varNameObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
varName = text;
|
||||
delete [] text;
|
||||
}
|
||||
else if (PyString_Check(varNameObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(varNameObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
varName = wText;
|
||||
delete [] wText;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createStringVar expects two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
std::wstring val = L"";
|
||||
if (PyUnicode_Check(valueObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(valueObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)valueObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
val = text;
|
||||
delete [] text;
|
||||
}
|
||||
else if (PyString_Check(valueObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(valueObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
val = wText;
|
||||
delete [] wText;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createStringVar expects two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
self->fThis->CreateStringVar(varName, val);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptVarSyncGame, createNumericVar, args)
|
||||
{
|
||||
PyObject* varNameObj = NULL;
|
||||
PyObject* valueObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "OO", &varNameObj, &valueObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createNumericVar expects a string and a number");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
std::wstring varName = L"";
|
||||
if (PyUnicode_Check(varNameObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(varNameObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)varNameObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
varName = text;
|
||||
delete [] text;
|
||||
}
|
||||
else if (PyString_Check(varNameObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(varNameObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
varName = wText;
|
||||
delete [] wText;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createNumericVar expects a string and a number");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
double val = 0;
|
||||
if (PyFloat_Check(valueObj))
|
||||
val = PyFloat_AsDouble(valueObj);
|
||||
else if (PyInt_Check(valueObj))
|
||||
val = (double)PyInt_AsLong(valueObj);
|
||||
else if (PyLong_Check(valueObj))
|
||||
val = PyLong_AsDouble(valueObj);
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createNumericVar expects a string and a number");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
self->fThis->CreateNumericVar(varName, val);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncGame)
|
||||
PYTHON_METHOD(ptVarSyncGame, setStringVar, "Params: varID, value\nAttempts to set a string variable to the specified string (clipped to 255 chars)"),
|
||||
PYTHON_METHOD(ptVarSyncGame, setNumericVar, "Params: varID, value\nAttempts to set a numeric variable to the specified number (clipped to double)"),
|
||||
PYTHON_BASIC_METHOD(ptVarSyncGame, requestAllVars, "Requests all the vars the server knows about"),
|
||||
PYTHON_METHOD(ptVarSyncGame, createStringVar, "Params: varName, value\nAttempts to create a new string variable and set it to the specified string (clipped to 255 chars)"),
|
||||
PYTHON_METHOD(ptVarSyncGame, createNumericVar, "Params: varName, value\nAttempts to create a new numeric variable and set it to the specified number (clipped to double)"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncGame, pyGameCli, "Game client for the VarSync game");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncGame::New(pfGameCli* client)
|
||||
{
|
||||
ptVarSyncGame *newObj = (ptVarSyncGame*)ptVarSyncGame_type.tp_new(&ptVarSyncGame_type, NULL, NULL);
|
||||
if (client && (client->GetGameTypeId() == kGameTypeId_VarSync))
|
||||
newObj->fThis->gameClient = client;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncGame, pyVarSyncGame)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncGame, pyVarSyncGame)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncGame::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncGame);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
void pyVarSyncGame::AddPlasmaMethods(std::vector<PyMethodDef>& methods)
|
||||
{
|
||||
PYTHON_GLOBAL_METHOD(methods, PtIsVarSyncGame);
|
||||
PYTHON_GLOBAL_METHOD(methods, PtJoinCommonVarSyncGame);
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#include "pyVarSyncGame.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyEnum.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base VarSync game client class
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncGame, pyVarSyncGame);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncGame, pyVarSyncGame)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncGame)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncGame)
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtIsVarSyncGame, args, "Params: typeID\nReturns true if the specifed typeID (guid as a string) is a VarSync game")
|
||||
{
|
||||
PyObject* textObj;
|
||||
if (!PyArg_ParseTuple(args, "O", &textObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtIsVarSyncGame expects a unicode string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (PyUnicode_Check(textObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(textObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
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");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtJoinCommonVarSyncGame, args, "Params: callbackKey\nJoins the common VarSync game. If one doesn't exist, it creates it")
|
||||
{
|
||||
PyObject* callbackObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "O", &callbackObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtJoinCommonVarSyncGame expects a ptKey");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (!pyKey::Check(callbackObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtJoinCommonVarSyncGame expects a ptKey");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyKey* key = pyKey::ConvertFrom(callbackObj);
|
||||
pyVarSyncGame::JoinCommonVarSyncGame(*key);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptVarSyncGame, setStringVar, args)
|
||||
{
|
||||
unsigned long id;
|
||||
PyObject* valueObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "kO", &id, &valueObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "setStringVar expects an unsigned long and a string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (PyUnicode_Check(valueObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(valueObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)valueObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
self->fThis->SetStringVar(id, text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
else if (PyString_Check(valueObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(valueObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
self->fThis->SetStringVar(id, wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "setStringVar expects an unsigned long and a string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptVarSyncGame, setNumericVar, args)
|
||||
{
|
||||
unsigned long id;
|
||||
PyObject* valueObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "kO", &id, &valueObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "setNumericVar expects an unsigned long and a number");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
double val = 0;
|
||||
if (PyFloat_Check(valueObj))
|
||||
val = PyFloat_AsDouble(valueObj);
|
||||
else if (PyInt_Check(valueObj))
|
||||
val = (double)PyInt_AsLong(valueObj);
|
||||
else if (PyLong_Check(valueObj))
|
||||
val = PyLong_AsDouble(valueObj);
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "setNumericVar expects an unsigned long and a number");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
self->fThis->SetNumericVar(id, val);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_BASIC_METHOD_DEFINITION(ptVarSyncGame, requestAllVars, RequestAllVars)
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptVarSyncGame, createStringVar, args)
|
||||
{
|
||||
PyObject* varNameObj = NULL;
|
||||
PyObject* valueObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "OO", &varNameObj, &valueObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createStringVar expects two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
std::wstring varName = L"";
|
||||
if (PyUnicode_Check(varNameObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(varNameObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)varNameObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
varName = text;
|
||||
delete [] text;
|
||||
}
|
||||
else if (PyString_Check(varNameObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(varNameObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
varName = wText;
|
||||
delete [] wText;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createStringVar expects two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
std::wstring val = L"";
|
||||
if (PyUnicode_Check(valueObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(valueObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)valueObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
val = text;
|
||||
delete [] text;
|
||||
}
|
||||
else if (PyString_Check(valueObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(valueObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
val = wText;
|
||||
delete [] wText;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createStringVar expects two strings");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
self->fThis->CreateStringVar(varName, val);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptVarSyncGame, createNumericVar, args)
|
||||
{
|
||||
PyObject* varNameObj = NULL;
|
||||
PyObject* valueObj = NULL;
|
||||
if (!PyArg_ParseTuple(args, "OO", &varNameObj, &valueObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createNumericVar expects a string and a number");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
std::wstring varName = L"";
|
||||
if (PyUnicode_Check(varNameObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(varNameObj);
|
||||
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)varNameObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
varName = text;
|
||||
delete [] text;
|
||||
}
|
||||
else if (PyString_Check(varNameObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(varNameObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
varName = wText;
|
||||
delete [] wText;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createNumericVar expects a string and a number");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
double val = 0;
|
||||
if (PyFloat_Check(valueObj))
|
||||
val = PyFloat_AsDouble(valueObj);
|
||||
else if (PyInt_Check(valueObj))
|
||||
val = (double)PyInt_AsLong(valueObj);
|
||||
else if (PyLong_Check(valueObj))
|
||||
val = PyLong_AsDouble(valueObj);
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "createNumericVar expects a string and a number");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
self->fThis->CreateNumericVar(varName, val);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncGame)
|
||||
PYTHON_METHOD(ptVarSyncGame, setStringVar, "Params: varID, value\nAttempts to set a string variable to the specified string (clipped to 255 chars)"),
|
||||
PYTHON_METHOD(ptVarSyncGame, setNumericVar, "Params: varID, value\nAttempts to set a numeric variable to the specified number (clipped to double)"),
|
||||
PYTHON_BASIC_METHOD(ptVarSyncGame, requestAllVars, "Requests all the vars the server knows about"),
|
||||
PYTHON_METHOD(ptVarSyncGame, createStringVar, "Params: varName, value\nAttempts to create a new string variable and set it to the specified string (clipped to 255 chars)"),
|
||||
PYTHON_METHOD(ptVarSyncGame, createNumericVar, "Params: varName, value\nAttempts to create a new numeric variable and set it to the specified number (clipped to double)"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncGame, pyGameCli, "Game client for the VarSync game");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncGame::New(pfGameCli* client)
|
||||
{
|
||||
ptVarSyncGame *newObj = (ptVarSyncGame*)ptVarSyncGame_type.tp_new(&ptVarSyncGame_type, NULL, NULL);
|
||||
if (client && (client->GetGameTypeId() == kGameTypeId_VarSync))
|
||||
newObj->fThis->gameClient = client;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncGame, pyVarSyncGame)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncGame, pyVarSyncGame)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncGame::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncGame);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
void pyVarSyncGame::AddPlasmaMethods(std::vector<PyMethodDef>& methods)
|
||||
{
|
||||
PYTHON_GLOBAL_METHOD(methods, PtIsVarSyncGame);
|
||||
PYTHON_GLOBAL_METHOD(methods, PtJoinCommonVarSyncGame);
|
||||
}
|
@ -1,217 +1,217 @@
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#include "pyVarSyncMsg.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base VarSync msg class
|
||||
//
|
||||
|
||||
pyVarSyncMsg::pyVarSyncMsg(): pyGameCliMsg() {}
|
||||
|
||||
pyVarSyncMsg::pyVarSyncMsg(pfGameCliMsg* msg): pyGameCliMsg(msg)
|
||||
{
|
||||
if (message && (message->gameCli->GetGameTypeId() != kGameTypeId_VarSync))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
int pyVarSyncMsg::GetVarSyncMsgType() const
|
||||
{
|
||||
if (message)
|
||||
return message->netMsg->messageId;
|
||||
return -1;
|
||||
}
|
||||
|
||||
PyObject* pyVarSyncMsg::UpcastToFinalVarSyncMsg() const
|
||||
{
|
||||
if (!message)
|
||||
PYTHON_RETURN_NONE;
|
||||
switch (message->netMsg->messageId)
|
||||
{
|
||||
case kSrv2Cli_VarSync_StringVarChanged:
|
||||
return pyVarSyncStringVarChangedMsg::New(message);
|
||||
case kSrv2Cli_VarSync_NumericVarChanged:
|
||||
return pyVarSyncNumericVarChangedMsg::New(message);
|
||||
case kSrv2Cli_VarSync_AllVarsSent:
|
||||
return pyVarSyncAllVarsSentMsg::New(message);
|
||||
case kSrv2Cli_VarSync_StringVarCreated:
|
||||
return pyVarSyncStringVarCreatedMsg::New(message);
|
||||
case kSrv2Cli_VarSync_NumericVarCreated:
|
||||
return pyVarSyncNumericVarCreatedMsg::New(message);
|
||||
default:
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The different messages we can receive
|
||||
//
|
||||
|
||||
pyVarSyncStringVarChangedMsg::pyVarSyncStringVarChangedMsg(): pyVarSyncMsg() {}
|
||||
|
||||
pyVarSyncStringVarChangedMsg::pyVarSyncStringVarChangedMsg(pfGameCliMsg* msg): pyVarSyncMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_VarSync_StringVarChanged))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyVarSyncStringVarChangedMsg::ID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_StringVarChanged* gmMsg = (const Srv2Cli_VarSync_StringVarChanged*)message->netMsg;
|
||||
return gmMsg->varID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::wstring pyVarSyncStringVarChangedMsg::Value() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_StringVarChanged* gmMsg = (const Srv2Cli_VarSync_StringVarChanged*)message->netMsg;
|
||||
return gmMsg->varValue;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyVarSyncNumericVarChangedMsg::pyVarSyncNumericVarChangedMsg(): pyVarSyncMsg() {}
|
||||
|
||||
pyVarSyncNumericVarChangedMsg::pyVarSyncNumericVarChangedMsg(pfGameCliMsg* msg): pyVarSyncMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_VarSync_NumericVarChanged))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyVarSyncNumericVarChangedMsg::ID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_NumericVarChanged* gmMsg = (const Srv2Cli_VarSync_NumericVarChanged*)message->netMsg;
|
||||
return gmMsg->varID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
double pyVarSyncNumericVarChangedMsg::Value() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_NumericVarChanged* gmMsg = (const Srv2Cli_VarSync_NumericVarChanged*)message->netMsg;
|
||||
return gmMsg->varValue;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyVarSyncAllVarsSentMsg::pyVarSyncAllVarsSentMsg(): pyVarSyncMsg() {}
|
||||
|
||||
pyVarSyncAllVarsSentMsg::pyVarSyncAllVarsSentMsg(pfGameCliMsg* msg): pyVarSyncMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_VarSync_AllVarsSent))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyVarSyncStringVarCreatedMsg::pyVarSyncStringVarCreatedMsg(): pyVarSyncMsg() {}
|
||||
|
||||
pyVarSyncStringVarCreatedMsg::pyVarSyncStringVarCreatedMsg(pfGameCliMsg* msg): pyVarSyncMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_VarSync_StringVarCreated))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
std::wstring pyVarSyncStringVarCreatedMsg::Name() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_StringVarCreated* gmMsg = (const Srv2Cli_VarSync_StringVarCreated*)message->netMsg;
|
||||
return gmMsg->varName;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
unsigned long pyVarSyncStringVarCreatedMsg::ID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_StringVarCreated* gmMsg = (const Srv2Cli_VarSync_StringVarCreated*)message->netMsg;
|
||||
return gmMsg->varID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::wstring pyVarSyncStringVarCreatedMsg::Value() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_StringVarCreated* gmMsg = (const Srv2Cli_VarSync_StringVarCreated*)message->netMsg;
|
||||
return gmMsg->varValue;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyVarSyncNumericVarCreatedMsg::pyVarSyncNumericVarCreatedMsg(): pyVarSyncMsg() {}
|
||||
|
||||
pyVarSyncNumericVarCreatedMsg::pyVarSyncNumericVarCreatedMsg(pfGameCliMsg* msg): pyVarSyncMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_VarSync_NumericVarCreated))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
std::wstring pyVarSyncNumericVarCreatedMsg::Name() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_NumericVarCreated* gmMsg = (const Srv2Cli_VarSync_NumericVarCreated*)message->netMsg;
|
||||
return gmMsg->varName;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
unsigned long pyVarSyncNumericVarCreatedMsg::ID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_NumericVarCreated* gmMsg = (const Srv2Cli_VarSync_NumericVarCreated*)message->netMsg;
|
||||
return gmMsg->varID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
double pyVarSyncNumericVarCreatedMsg::Value() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_NumericVarCreated* gmMsg = (const Srv2Cli_VarSync_NumericVarCreated*)message->netMsg;
|
||||
return gmMsg->varValue;
|
||||
}
|
||||
return 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/>.
|
||||
|
||||
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==*/
|
||||
#include "pyVarSyncMsg.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base VarSync msg class
|
||||
//
|
||||
|
||||
pyVarSyncMsg::pyVarSyncMsg(): pyGameCliMsg() {}
|
||||
|
||||
pyVarSyncMsg::pyVarSyncMsg(pfGameCliMsg* msg): pyGameCliMsg(msg)
|
||||
{
|
||||
if (message && (message->gameCli->GetGameTypeId() != kGameTypeId_VarSync))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
int pyVarSyncMsg::GetVarSyncMsgType() const
|
||||
{
|
||||
if (message)
|
||||
return message->netMsg->messageId;
|
||||
return -1;
|
||||
}
|
||||
|
||||
PyObject* pyVarSyncMsg::UpcastToFinalVarSyncMsg() const
|
||||
{
|
||||
if (!message)
|
||||
PYTHON_RETURN_NONE;
|
||||
switch (message->netMsg->messageId)
|
||||
{
|
||||
case kSrv2Cli_VarSync_StringVarChanged:
|
||||
return pyVarSyncStringVarChangedMsg::New(message);
|
||||
case kSrv2Cli_VarSync_NumericVarChanged:
|
||||
return pyVarSyncNumericVarChangedMsg::New(message);
|
||||
case kSrv2Cli_VarSync_AllVarsSent:
|
||||
return pyVarSyncAllVarsSentMsg::New(message);
|
||||
case kSrv2Cli_VarSync_StringVarCreated:
|
||||
return pyVarSyncStringVarCreatedMsg::New(message);
|
||||
case kSrv2Cli_VarSync_NumericVarCreated:
|
||||
return pyVarSyncNumericVarCreatedMsg::New(message);
|
||||
default:
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The different messages we can receive
|
||||
//
|
||||
|
||||
pyVarSyncStringVarChangedMsg::pyVarSyncStringVarChangedMsg(): pyVarSyncMsg() {}
|
||||
|
||||
pyVarSyncStringVarChangedMsg::pyVarSyncStringVarChangedMsg(pfGameCliMsg* msg): pyVarSyncMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_VarSync_StringVarChanged))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyVarSyncStringVarChangedMsg::ID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_StringVarChanged* gmMsg = (const Srv2Cli_VarSync_StringVarChanged*)message->netMsg;
|
||||
return gmMsg->varID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::wstring pyVarSyncStringVarChangedMsg::Value() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_StringVarChanged* gmMsg = (const Srv2Cli_VarSync_StringVarChanged*)message->netMsg;
|
||||
return gmMsg->varValue;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyVarSyncNumericVarChangedMsg::pyVarSyncNumericVarChangedMsg(): pyVarSyncMsg() {}
|
||||
|
||||
pyVarSyncNumericVarChangedMsg::pyVarSyncNumericVarChangedMsg(pfGameCliMsg* msg): pyVarSyncMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_VarSync_NumericVarChanged))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyVarSyncNumericVarChangedMsg::ID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_NumericVarChanged* gmMsg = (const Srv2Cli_VarSync_NumericVarChanged*)message->netMsg;
|
||||
return gmMsg->varID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
double pyVarSyncNumericVarChangedMsg::Value() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_NumericVarChanged* gmMsg = (const Srv2Cli_VarSync_NumericVarChanged*)message->netMsg;
|
||||
return gmMsg->varValue;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyVarSyncAllVarsSentMsg::pyVarSyncAllVarsSentMsg(): pyVarSyncMsg() {}
|
||||
|
||||
pyVarSyncAllVarsSentMsg::pyVarSyncAllVarsSentMsg(pfGameCliMsg* msg): pyVarSyncMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_VarSync_AllVarsSent))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyVarSyncStringVarCreatedMsg::pyVarSyncStringVarCreatedMsg(): pyVarSyncMsg() {}
|
||||
|
||||
pyVarSyncStringVarCreatedMsg::pyVarSyncStringVarCreatedMsg(pfGameCliMsg* msg): pyVarSyncMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_VarSync_StringVarCreated))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
std::wstring pyVarSyncStringVarCreatedMsg::Name() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_StringVarCreated* gmMsg = (const Srv2Cli_VarSync_StringVarCreated*)message->netMsg;
|
||||
return gmMsg->varName;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
unsigned long pyVarSyncStringVarCreatedMsg::ID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_StringVarCreated* gmMsg = (const Srv2Cli_VarSync_StringVarCreated*)message->netMsg;
|
||||
return gmMsg->varID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::wstring pyVarSyncStringVarCreatedMsg::Value() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_StringVarCreated* gmMsg = (const Srv2Cli_VarSync_StringVarCreated*)message->netMsg;
|
||||
return gmMsg->varValue;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyVarSyncNumericVarCreatedMsg::pyVarSyncNumericVarCreatedMsg(): pyVarSyncMsg() {}
|
||||
|
||||
pyVarSyncNumericVarCreatedMsg::pyVarSyncNumericVarCreatedMsg(pfGameCliMsg* msg): pyVarSyncMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_VarSync_NumericVarCreated))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
std::wstring pyVarSyncNumericVarCreatedMsg::Name() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_NumericVarCreated* gmMsg = (const Srv2Cli_VarSync_NumericVarCreated*)message->netMsg;
|
||||
return gmMsg->varName;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
unsigned long pyVarSyncNumericVarCreatedMsg::ID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_NumericVarCreated* gmMsg = (const Srv2Cli_VarSync_NumericVarCreated*)message->netMsg;
|
||||
return gmMsg->varID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
double pyVarSyncNumericVarCreatedMsg::Value() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_VarSync_NumericVarCreated* gmMsg = (const Srv2Cli_VarSync_NumericVarCreated*)message->netMsg;
|
||||
return gmMsg->varValue;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -1,163 +1,163 @@
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#ifndef pyVarSyncMsg_h
|
||||
#define pyVarSyncMsg_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: pyVarSyncMsg
|
||||
//
|
||||
// PURPOSE: Class wrapper for VarSync game messages
|
||||
//
|
||||
|
||||
#include "pfGameMgr/pfGameMgr.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyGlueHelpers.h"
|
||||
#include "../pyGameCliMsg.h"
|
||||
|
||||
class pyVarSyncMsg : public pyGameCliMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncMsg();
|
||||
pyVarSyncMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_EXPOSE_TYPE; // so we can subclass
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncMsg); // converts a PyObject to a pyVarSyncMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
static void AddPlasmaConstantsClasses(PyObject* m);
|
||||
|
||||
int GetVarSyncMsgType() const;
|
||||
|
||||
PyObject* UpcastToFinalVarSyncMsg() const; // returns the VarSync message that this really is
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyVarSyncStringVarChangedMsg : public pyVarSyncMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncStringVarChangedMsg();
|
||||
pyVarSyncStringVarChangedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncStringVarChangedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncStringVarChangedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncStringVarChangedMsg); // converts a PyObject to a pyVarSyncStringVarChangedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long ID() const;
|
||||
std::wstring Value() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyVarSyncNumericVarChangedMsg : public pyVarSyncMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncNumericVarChangedMsg();
|
||||
pyVarSyncNumericVarChangedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncNumericVarChangedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncNumericVarChangedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncNumericVarChangedMsg); // converts a PyObject to a pyVarSyncNumericVarChangedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long ID() const;
|
||||
double Value() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyVarSyncAllVarsSentMsg : public pyVarSyncMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncAllVarsSentMsg();
|
||||
pyVarSyncAllVarsSentMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncAllVarsSentMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncAllVarsSentMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncAllVarsSentMsg); // converts a PyObject to a pyVarSyncAllVarsSentMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyVarSyncStringVarCreatedMsg : public pyVarSyncMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncStringVarCreatedMsg();
|
||||
pyVarSyncStringVarCreatedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncStringVarCreatedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncStringVarCreatedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncStringVarCreatedMsg); // converts a PyObject to a pyVarSyncStringVarCreatedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
std::wstring Name() const;
|
||||
unsigned long ID() const;
|
||||
std::wstring Value() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyVarSyncNumericVarCreatedMsg : public pyVarSyncMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncNumericVarCreatedMsg();
|
||||
pyVarSyncNumericVarCreatedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncNumericVarCreatedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncNumericVarCreatedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncNumericVarCreatedMsg); // converts a PyObject to a pyVarSyncNumericVarCreatedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
std::wstring Name() const;
|
||||
unsigned long ID() const;
|
||||
double Value() const;
|
||||
};
|
||||
|
||||
#endif // pyVarSyncMsg_h
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#ifndef pyVarSyncMsg_h
|
||||
#define pyVarSyncMsg_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: pyVarSyncMsg
|
||||
//
|
||||
// PURPOSE: Class wrapper for VarSync game messages
|
||||
//
|
||||
|
||||
#include "pfGameMgr/pfGameMgr.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyGlueHelpers.h"
|
||||
#include "../pyGameCliMsg.h"
|
||||
|
||||
class pyVarSyncMsg : public pyGameCliMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncMsg();
|
||||
pyVarSyncMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_EXPOSE_TYPE; // so we can subclass
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncMsg); // converts a PyObject to a pyVarSyncMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
static void AddPlasmaConstantsClasses(PyObject* m);
|
||||
|
||||
int GetVarSyncMsgType() const;
|
||||
|
||||
PyObject* UpcastToFinalVarSyncMsg() const; // returns the VarSync message that this really is
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyVarSyncStringVarChangedMsg : public pyVarSyncMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncStringVarChangedMsg();
|
||||
pyVarSyncStringVarChangedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncStringVarChangedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncStringVarChangedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncStringVarChangedMsg); // converts a PyObject to a pyVarSyncStringVarChangedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long ID() const;
|
||||
std::wstring Value() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyVarSyncNumericVarChangedMsg : public pyVarSyncMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncNumericVarChangedMsg();
|
||||
pyVarSyncNumericVarChangedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncNumericVarChangedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncNumericVarChangedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncNumericVarChangedMsg); // converts a PyObject to a pyVarSyncNumericVarChangedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long ID() const;
|
||||
double Value() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyVarSyncAllVarsSentMsg : public pyVarSyncMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncAllVarsSentMsg();
|
||||
pyVarSyncAllVarsSentMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncAllVarsSentMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncAllVarsSentMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncAllVarsSentMsg); // converts a PyObject to a pyVarSyncAllVarsSentMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyVarSyncStringVarCreatedMsg : public pyVarSyncMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncStringVarCreatedMsg();
|
||||
pyVarSyncStringVarCreatedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncStringVarCreatedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncStringVarCreatedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncStringVarCreatedMsg); // converts a PyObject to a pyVarSyncStringVarCreatedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
std::wstring Name() const;
|
||||
unsigned long ID() const;
|
||||
std::wstring Value() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyVarSyncNumericVarCreatedMsg : public pyVarSyncMsg
|
||||
{
|
||||
protected:
|
||||
pyVarSyncNumericVarCreatedMsg();
|
||||
pyVarSyncNumericVarCreatedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptVarSyncNumericVarCreatedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyVarSyncNumericVarCreatedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyVarSyncNumericVarCreatedMsg); // converts a PyObject to a pyVarSyncNumericVarCreatedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
std::wstring Name() const;
|
||||
unsigned long ID() const;
|
||||
double Value() const;
|
||||
};
|
||||
|
||||
#endif // pyVarSyncMsg_h
|
||||
|
@ -1,329 +1,329 @@
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#include "pyVarSyncMsg.h"
|
||||
#include "../../pyEnum.h"
|
||||
|
||||
#include <python.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base VarSync msg class
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncMsg, pyVarSyncMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncMsg, pyVarSyncMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncMsg, getVarSyncMsgType)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->GetVarSyncMsgType());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncMsg, upcastToFinalVarSyncMsg)
|
||||
{
|
||||
return self->fThis->UpcastToFinalVarSyncMsg();
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncMsg)
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncMsg, getVarSyncMsgType, "Returns the type of the VarSync message (see PtVarSyncMsgTypes)"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncMsg, upcastToFinalVarSyncMsg, "Returns this message as the VarSync msg it is"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncMsg, pyGameCliMsg, "Base class for VarSync game messages");
|
||||
PYTHON_EXPOSE_TYPE_DEFINITION(ptVarSyncMsg, pyVarSyncMsg);
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncMsg *newObj = (ptVarSyncMsg*)ptVarSyncMsg_type.tp_new(&ptVarSyncMsg_type, NULL, NULL);
|
||||
if (msg && (msg->gameCli->GetGameTypeId() == kGameTypeId_VarSync))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncMsg, pyVarSyncMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncMsg, pyVarSyncMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
void pyVarSyncMsg::AddPlasmaConstantsClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_ENUM_START(PtVarSyncMsgTypes);
|
||||
PYTHON_ENUM_ELEMENT(PtVarSyncMsgTypes, kVarSyncStringVarChanged, kSrv2Cli_VarSync_StringVarChanged);
|
||||
PYTHON_ENUM_ELEMENT(PtVarSyncMsgTypes, kVarSyncNumericVarChanged, kSrv2Cli_VarSync_NumericVarChanged);
|
||||
PYTHON_ENUM_ELEMENT(PtVarSyncMsgTypes, kVarSyncAllVarsSent, kSrv2Cli_VarSync_AllVarsSent);
|
||||
PYTHON_ENUM_ELEMENT(PtVarSyncMsgTypes, kVarSyncStringVarCreated, kSrv2Cli_VarSync_StringVarCreated);
|
||||
PYTHON_ENUM_ELEMENT(PtVarSyncMsgTypes, kVarSyncNumericVarCreated, kSrv2Cli_VarSync_NumericVarCreated);
|
||||
PYTHON_ENUM_END(m, PtVarSyncMsgTypes);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Game client message subclasses
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncStringVarChangedMsg, pyVarSyncStringVarChangedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncStringVarChangedMsg, pyVarSyncStringVarChangedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncStringVarChangedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncStringVarChangedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncStringVarChangedMsg, id)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->ID());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncStringVarChangedMsg, value)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Value();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.size());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncStringVarChangedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncStringVarChangedMsg, id, "Returns the id of the var that changed"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncStringVarChangedMsg, value, "Returns the variable's new value"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncStringVarChangedMsg, pyVarSyncMsg, "VarSync message received when a string variable's value changes");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncStringVarChangedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncStringVarChangedMsg *newObj = (ptVarSyncStringVarChangedMsg*)ptVarSyncStringVarChangedMsg_type.tp_new(&ptVarSyncStringVarChangedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_VarSync_StringVarChanged))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncStringVarChangedMsg, pyVarSyncStringVarChangedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncStringVarChangedMsg, pyVarSyncStringVarChangedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncStringVarChangedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncStringVarChangedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncNumericVarChangedMsg, pyVarSyncNumericVarChangedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncNumericVarChangedMsg, pyVarSyncNumericVarChangedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncNumericVarChangedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncNumericVarChangedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncNumericVarChangedMsg, id)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->ID());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncNumericVarChangedMsg, value)
|
||||
{
|
||||
return PyLong_FromDouble(self->fThis->Value());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncNumericVarChangedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncNumericVarChangedMsg, id, "Returns the id of the var that changed"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncNumericVarChangedMsg, value, "Returns the variable's new value"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncNumericVarChangedMsg, pyVarSyncMsg, "VarSync message received when a numeric variable's value changes");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncNumericVarChangedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncNumericVarChangedMsg *newObj = (ptVarSyncNumericVarChangedMsg*)ptVarSyncNumericVarChangedMsg_type.tp_new(&ptVarSyncNumericVarChangedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_VarSync_NumericVarChanged))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncNumericVarChangedMsg, pyVarSyncNumericVarChangedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncNumericVarChangedMsg, pyVarSyncNumericVarChangedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncNumericVarChangedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncNumericVarChangedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncAllVarsSentMsg, pyVarSyncAllVarsSentMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncAllVarsSentMsg, pyVarSyncAllVarsSentMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncAllVarsSentMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncAllVarsSentMsg)
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncAllVarsSentMsg)
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncAllVarsSentMsg, pyVarSyncMsg, "VarSync message received after the last var is sent to you when you join the game, or request a list of vars");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncAllVarsSentMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncAllVarsSentMsg *newObj = (ptVarSyncAllVarsSentMsg*)ptVarSyncAllVarsSentMsg_type.tp_new(&ptVarSyncAllVarsSentMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_VarSync_AllVarsSent))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncAllVarsSentMsg, pyVarSyncAllVarsSentMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncAllVarsSentMsg, pyVarSyncAllVarsSentMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncAllVarsSentMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncAllVarsSentMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncStringVarCreatedMsg, pyVarSyncStringVarCreatedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncStringVarCreatedMsg, pyVarSyncStringVarCreatedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncStringVarCreatedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncStringVarCreatedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncStringVarCreatedMsg, name)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Name();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.size());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncStringVarCreatedMsg, id)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->ID());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncStringVarCreatedMsg, value)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Value();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.size());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncStringVarCreatedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncStringVarCreatedMsg, name, "Returns the name of the var that was created"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncStringVarCreatedMsg, id, "Returns the id that was assigned to this variable"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncStringVarCreatedMsg, value, "Returns the variable's new value"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncStringVarCreatedMsg, pyVarSyncMsg, "VarSync message received when a string variable is created and assigned an id");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncStringVarCreatedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncStringVarCreatedMsg *newObj = (ptVarSyncStringVarCreatedMsg*)ptVarSyncStringVarCreatedMsg_type.tp_new(&ptVarSyncStringVarCreatedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_VarSync_StringVarCreated))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncStringVarCreatedMsg, pyVarSyncStringVarCreatedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncStringVarCreatedMsg, pyVarSyncStringVarCreatedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncStringVarCreatedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncStringVarCreatedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncNumericVarCreatedMsg, pyVarSyncNumericVarCreatedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncNumericVarCreatedMsg, pyVarSyncNumericVarCreatedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncNumericVarCreatedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncNumericVarCreatedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncNumericVarCreatedMsg, name)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Name();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.size());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncNumericVarCreatedMsg, id)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->ID());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncNumericVarCreatedMsg, value)
|
||||
{
|
||||
return PyLong_FromDouble(self->fThis->Value());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncNumericVarCreatedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncNumericVarCreatedMsg, name, "Returns the name of the var that was created"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncNumericVarCreatedMsg, id, "Returns the id assigned to this variable"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncNumericVarCreatedMsg, value, "Returns the variable's new value"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncNumericVarCreatedMsg, pyVarSyncMsg, "VarSync message received when a numeric variable is created and assigned an id");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncNumericVarCreatedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncNumericVarCreatedMsg *newObj = (ptVarSyncNumericVarCreatedMsg*)ptVarSyncNumericVarCreatedMsg_type.tp_new(&ptVarSyncNumericVarCreatedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_VarSync_NumericVarCreated))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncNumericVarCreatedMsg, pyVarSyncNumericVarCreatedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncNumericVarCreatedMsg, pyVarSyncNumericVarCreatedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncNumericVarCreatedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncNumericVarCreatedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
/*==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/>.
|
||||
|
||||
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==*/
|
||||
#include "pyVarSyncMsg.h"
|
||||
#include "../../pyEnum.h"
|
||||
|
||||
#include <python.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base VarSync msg class
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncMsg, pyVarSyncMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncMsg, pyVarSyncMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncMsg, getVarSyncMsgType)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->GetVarSyncMsgType());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncMsg, upcastToFinalVarSyncMsg)
|
||||
{
|
||||
return self->fThis->UpcastToFinalVarSyncMsg();
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncMsg)
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncMsg, getVarSyncMsgType, "Returns the type of the VarSync message (see PtVarSyncMsgTypes)"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncMsg, upcastToFinalVarSyncMsg, "Returns this message as the VarSync msg it is"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncMsg, pyGameCliMsg, "Base class for VarSync game messages");
|
||||
PYTHON_EXPOSE_TYPE_DEFINITION(ptVarSyncMsg, pyVarSyncMsg);
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncMsg *newObj = (ptVarSyncMsg*)ptVarSyncMsg_type.tp_new(&ptVarSyncMsg_type, NULL, NULL);
|
||||
if (msg && (msg->gameCli->GetGameTypeId() == kGameTypeId_VarSync))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncMsg, pyVarSyncMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncMsg, pyVarSyncMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
void pyVarSyncMsg::AddPlasmaConstantsClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_ENUM_START(PtVarSyncMsgTypes);
|
||||
PYTHON_ENUM_ELEMENT(PtVarSyncMsgTypes, kVarSyncStringVarChanged, kSrv2Cli_VarSync_StringVarChanged);
|
||||
PYTHON_ENUM_ELEMENT(PtVarSyncMsgTypes, kVarSyncNumericVarChanged, kSrv2Cli_VarSync_NumericVarChanged);
|
||||
PYTHON_ENUM_ELEMENT(PtVarSyncMsgTypes, kVarSyncAllVarsSent, kSrv2Cli_VarSync_AllVarsSent);
|
||||
PYTHON_ENUM_ELEMENT(PtVarSyncMsgTypes, kVarSyncStringVarCreated, kSrv2Cli_VarSync_StringVarCreated);
|
||||
PYTHON_ENUM_ELEMENT(PtVarSyncMsgTypes, kVarSyncNumericVarCreated, kSrv2Cli_VarSync_NumericVarCreated);
|
||||
PYTHON_ENUM_END(m, PtVarSyncMsgTypes);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Game client message subclasses
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncStringVarChangedMsg, pyVarSyncStringVarChangedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncStringVarChangedMsg, pyVarSyncStringVarChangedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncStringVarChangedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncStringVarChangedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncStringVarChangedMsg, id)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->ID());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncStringVarChangedMsg, value)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Value();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.size());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncStringVarChangedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncStringVarChangedMsg, id, "Returns the id of the var that changed"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncStringVarChangedMsg, value, "Returns the variable's new value"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncStringVarChangedMsg, pyVarSyncMsg, "VarSync message received when a string variable's value changes");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncStringVarChangedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncStringVarChangedMsg *newObj = (ptVarSyncStringVarChangedMsg*)ptVarSyncStringVarChangedMsg_type.tp_new(&ptVarSyncStringVarChangedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_VarSync_StringVarChanged))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncStringVarChangedMsg, pyVarSyncStringVarChangedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncStringVarChangedMsg, pyVarSyncStringVarChangedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncStringVarChangedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncStringVarChangedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncNumericVarChangedMsg, pyVarSyncNumericVarChangedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncNumericVarChangedMsg, pyVarSyncNumericVarChangedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncNumericVarChangedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncNumericVarChangedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncNumericVarChangedMsg, id)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->ID());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncNumericVarChangedMsg, value)
|
||||
{
|
||||
return PyLong_FromDouble(self->fThis->Value());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncNumericVarChangedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncNumericVarChangedMsg, id, "Returns the id of the var that changed"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncNumericVarChangedMsg, value, "Returns the variable's new value"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncNumericVarChangedMsg, pyVarSyncMsg, "VarSync message received when a numeric variable's value changes");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncNumericVarChangedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncNumericVarChangedMsg *newObj = (ptVarSyncNumericVarChangedMsg*)ptVarSyncNumericVarChangedMsg_type.tp_new(&ptVarSyncNumericVarChangedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_VarSync_NumericVarChanged))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncNumericVarChangedMsg, pyVarSyncNumericVarChangedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncNumericVarChangedMsg, pyVarSyncNumericVarChangedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncNumericVarChangedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncNumericVarChangedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncAllVarsSentMsg, pyVarSyncAllVarsSentMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncAllVarsSentMsg, pyVarSyncAllVarsSentMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncAllVarsSentMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncAllVarsSentMsg)
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncAllVarsSentMsg)
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncAllVarsSentMsg, pyVarSyncMsg, "VarSync message received after the last var is sent to you when you join the game, or request a list of vars");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncAllVarsSentMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncAllVarsSentMsg *newObj = (ptVarSyncAllVarsSentMsg*)ptVarSyncAllVarsSentMsg_type.tp_new(&ptVarSyncAllVarsSentMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_VarSync_AllVarsSent))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncAllVarsSentMsg, pyVarSyncAllVarsSentMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncAllVarsSentMsg, pyVarSyncAllVarsSentMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncAllVarsSentMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncAllVarsSentMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncStringVarCreatedMsg, pyVarSyncStringVarCreatedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncStringVarCreatedMsg, pyVarSyncStringVarCreatedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncStringVarCreatedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncStringVarCreatedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncStringVarCreatedMsg, name)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Name();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.size());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncStringVarCreatedMsg, id)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->ID());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncStringVarCreatedMsg, value)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Value();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.size());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncStringVarCreatedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncStringVarCreatedMsg, name, "Returns the name of the var that was created"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncStringVarCreatedMsg, id, "Returns the id that was assigned to this variable"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncStringVarCreatedMsg, value, "Returns the variable's new value"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncStringVarCreatedMsg, pyVarSyncMsg, "VarSync message received when a string variable is created and assigned an id");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncStringVarCreatedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncStringVarCreatedMsg *newObj = (ptVarSyncStringVarCreatedMsg*)ptVarSyncStringVarCreatedMsg_type.tp_new(&ptVarSyncStringVarCreatedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_VarSync_StringVarCreated))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncStringVarCreatedMsg, pyVarSyncStringVarCreatedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncStringVarCreatedMsg, pyVarSyncStringVarCreatedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncStringVarCreatedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncStringVarCreatedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptVarSyncNumericVarCreatedMsg, pyVarSyncNumericVarCreatedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptVarSyncNumericVarCreatedMsg, pyVarSyncNumericVarCreatedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVarSyncNumericVarCreatedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptVarSyncNumericVarCreatedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncNumericVarCreatedMsg, name)
|
||||
{
|
||||
std::wstring retVal = self->fThis->Name();
|
||||
return PyUnicode_FromWideChar(retVal.c_str(), retVal.size());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncNumericVarCreatedMsg, id)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->ID());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptVarSyncNumericVarCreatedMsg, value)
|
||||
{
|
||||
return PyLong_FromDouble(self->fThis->Value());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptVarSyncNumericVarCreatedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncNumericVarCreatedMsg, name, "Returns the name of the var that was created"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncNumericVarCreatedMsg, id, "Returns the id assigned to this variable"),
|
||||
PYTHON_METHOD_NOARGS(ptVarSyncNumericVarCreatedMsg, value, "Returns the variable's new value"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptVarSyncNumericVarCreatedMsg, pyVarSyncMsg, "VarSync message received when a numeric variable is created and assigned an id");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyVarSyncNumericVarCreatedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptVarSyncNumericVarCreatedMsg *newObj = (ptVarSyncNumericVarCreatedMsg*)ptVarSyncNumericVarCreatedMsg_type.tp_new(&ptVarSyncNumericVarCreatedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_VarSync_NumericVarCreated))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptVarSyncNumericVarCreatedMsg, pyVarSyncNumericVarCreatedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptVarSyncNumericVarCreatedMsg, pyVarSyncNumericVarCreatedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyVarSyncNumericVarCreatedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptVarSyncNumericVarCreatedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
Reference in New Issue
Block a user