mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-13 18:17:49 -04:00
Renormalize line endings on entire repository to <LF> (for files in repository).
.gitattributes will alter text endings depending on platform with "text=auto"
This commit is contained in:
@ -1,93 +1,93 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "pyTTTGame.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base TTT game client class
|
||||
//
|
||||
|
||||
pyTTTGame::pyTTTGame(): pyGameCli() {}
|
||||
|
||||
pyTTTGame::pyTTTGame(pfGameCli* client): pyGameCli(client)
|
||||
{
|
||||
if (client && (client->GetGameTypeId() != kGameTypeId_TicTacToe))
|
||||
gameClient = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
bool pyTTTGame::IsTTTGame(std::wstring guid)
|
||||
{
|
||||
Uuid gameUuid(guid.c_str());
|
||||
return gameUuid == kGameTypeId_TicTacToe;
|
||||
}
|
||||
|
||||
void pyTTTGame::CreateTTTGame(pyKey& callbackKey, unsigned numPlayers)
|
||||
{
|
||||
TTT_CreateParam init;
|
||||
init.playerCount = numPlayers;
|
||||
pfGameMgr::GetInstance()->CreateGame(callbackKey.getKey(), kGameTypeId_TicTacToe, 0, sizeof(init), &init);
|
||||
}
|
||||
|
||||
void pyTTTGame::JoinCommonTTTGame(pyKey& callbackKey, unsigned gameID, unsigned numPlayers)
|
||||
{
|
||||
TTT_CreateParam init;
|
||||
init.playerCount = numPlayers;
|
||||
pfGameMgr::GetInstance()->JoinCommonGame(callbackKey.getKey(), kGameTypeId_TicTacToe, gameID, sizeof(init), &init);
|
||||
}
|
||||
|
||||
void pyTTTGame::MakeMove(unsigned row, unsigned col)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmTicTacToe* ttt = pfGmTicTacToe::ConvertNoRef(gameClient);
|
||||
ttt->MakeMove(row, col);
|
||||
}
|
||||
}
|
||||
|
||||
void pyTTTGame::ShowBoard()
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmTicTacToe* ttt = pfGmTicTacToe::ConvertNoRef(gameClient);
|
||||
ttt->ShowBoard();
|
||||
}
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "pyTTTGame.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base TTT game client class
|
||||
//
|
||||
|
||||
pyTTTGame::pyTTTGame(): pyGameCli() {}
|
||||
|
||||
pyTTTGame::pyTTTGame(pfGameCli* client): pyGameCli(client)
|
||||
{
|
||||
if (client && (client->GetGameTypeId() != kGameTypeId_TicTacToe))
|
||||
gameClient = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
bool pyTTTGame::IsTTTGame(std::wstring guid)
|
||||
{
|
||||
Uuid gameUuid(guid.c_str());
|
||||
return gameUuid == kGameTypeId_TicTacToe;
|
||||
}
|
||||
|
||||
void pyTTTGame::CreateTTTGame(pyKey& callbackKey, unsigned numPlayers)
|
||||
{
|
||||
TTT_CreateParam init;
|
||||
init.playerCount = numPlayers;
|
||||
pfGameMgr::GetInstance()->CreateGame(callbackKey.getKey(), kGameTypeId_TicTacToe, 0, sizeof(init), &init);
|
||||
}
|
||||
|
||||
void pyTTTGame::JoinCommonTTTGame(pyKey& callbackKey, unsigned gameID, unsigned numPlayers)
|
||||
{
|
||||
TTT_CreateParam init;
|
||||
init.playerCount = numPlayers;
|
||||
pfGameMgr::GetInstance()->JoinCommonGame(callbackKey.getKey(), kGameTypeId_TicTacToe, gameID, sizeof(init), &init);
|
||||
}
|
||||
|
||||
void pyTTTGame::MakeMove(unsigned row, unsigned col)
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmTicTacToe* ttt = pfGmTicTacToe::ConvertNoRef(gameClient);
|
||||
ttt->MakeMove(row, col);
|
||||
}
|
||||
}
|
||||
|
||||
void pyTTTGame::ShowBoard()
|
||||
{
|
||||
if (gameClient)
|
||||
{
|
||||
pfGmTicTacToe* ttt = pfGmTicTacToe::ConvertNoRef(gameClient);
|
||||
ttt->ShowBoard();
|
||||
}
|
||||
}
|
@ -1,84 +1,84 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef pyTTTGame_h
|
||||
#define pyTTTGame_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: pyTTTGame
|
||||
//
|
||||
// PURPOSE: Class wrapper for the TTT game client
|
||||
//
|
||||
|
||||
#include "../pfGameMgr/pfGameMgr.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyGlueHelpers.h"
|
||||
#include "../pyGameCli.h"
|
||||
#include "../../pyKey.h"
|
||||
|
||||
class pyTTTGame : public pyGameCli
|
||||
{
|
||||
protected:
|
||||
pyTTTGame();
|
||||
pyTTTGame(pfGameCli* client);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptTTTGame);
|
||||
static PyObject* New(pfGameCli* client);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyTTTGame object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyTTTGame); // converts a PyObject to a pyTTTGame (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
static void AddPlasmaConstantsClasses(PyObject* m);
|
||||
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
|
||||
|
||||
static bool IsTTTGame(std::wstring guid);
|
||||
static void CreateTTTGame(pyKey& callbackKey, unsigned numPlayers);
|
||||
static void JoinCommonTTTGame(pyKey& callbackKey, unsigned gameID, unsigned numPlayers);
|
||||
|
||||
void MakeMove(unsigned row, unsigned col);
|
||||
void ShowBoard();
|
||||
};
|
||||
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef pyTTTGame_h
|
||||
#define pyTTTGame_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: pyTTTGame
|
||||
//
|
||||
// PURPOSE: Class wrapper for the TTT game client
|
||||
//
|
||||
|
||||
#include "../pfGameMgr/pfGameMgr.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyGlueHelpers.h"
|
||||
#include "../pyGameCli.h"
|
||||
#include "../../pyKey.h"
|
||||
|
||||
class pyTTTGame : public pyGameCli
|
||||
{
|
||||
protected:
|
||||
pyTTTGame();
|
||||
pyTTTGame(pfGameCli* client);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptTTTGame);
|
||||
static PyObject* New(pfGameCli* client);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyTTTGame object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyTTTGame); // converts a PyObject to a pyTTTGame (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
static void AddPlasmaConstantsClasses(PyObject* m);
|
||||
static void AddPlasmaMethods(std::vector<PyMethodDef>& methods);
|
||||
|
||||
static bool IsTTTGame(std::wstring guid);
|
||||
static void CreateTTTGame(pyKey& callbackKey, unsigned numPlayers);
|
||||
static void JoinCommonTTTGame(pyKey& callbackKey, unsigned gameID, unsigned numPlayers);
|
||||
|
||||
void MakeMove(unsigned row, unsigned col);
|
||||
void ShowBoard();
|
||||
};
|
||||
|
||||
#endif // pyTTTGame_h
|
@ -1,188 +1,188 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "pyTTTGame.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyEnum.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base TTT game client class
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptTTTGame, pyTTTGame);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptTTTGame, pyTTTGame)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptTTTGame)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptTTTGame)
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtIsTTTGame, args, "Params: typeID\nReturns true if the specifed typeID (guid as a string) is a TicTacToe game")
|
||||
{
|
||||
PyObject* textObj;
|
||||
if (!PyArg_ParseTuple(args, "O", &textObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtIsTTTGame 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 = pyTTTGame::IsTTTGame(text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
}
|
||||
else if (PyString_Check(textObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(textObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
bool retVal = pyTTTGame::IsTTTGame(wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a unicode string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtCreateTTTGame, args, "Params: callbackKey, numPlayers\nCreates a new TicTacToe game with the specified callback key and number of players (1 or 2)")
|
||||
{
|
||||
PyObject* callbackObj = NULL;
|
||||
int numPlayers = 0;
|
||||
if (!PyArg_ParseTuple(args, "Oi", &callbackObj, &numPlayers))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtCreateTTTGame expects a ptKey and an integer");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (!pyKey::Check(callbackObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtCreateTTTGame expects a ptKey and an integer");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyKey* key = pyKey::ConvertFrom(callbackObj);
|
||||
pyTTTGame::CreateTTTGame(*key, numPlayers);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtJoinCommonTTTGame, args, "Params: callbackKey, gameID, numPlayers\nJoins a common TicTacToe game with the specified ID. If one doesn't exist, it creates it with the specified number of players")
|
||||
{
|
||||
PyObject* callbackObj = NULL;
|
||||
int gameID = 0, numPlayers = 0;
|
||||
if (!PyArg_ParseTuple(args, "Oii", &callbackObj, &gameID, &numPlayers))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtJoinCommonTTTGame expects a ptKey and two integers");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (!pyKey::Check(callbackObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtJoinCommonTTTGame expects a ptKey and two integers");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyKey* key = pyKey::ConvertFrom(callbackObj);
|
||||
pyTTTGame::JoinCommonTTTGame(*key, gameID, numPlayers);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptTTTGame, makeMove, args)
|
||||
{
|
||||
int row = 0, col = 0;
|
||||
if (!PyArg_ParseTuple(args, "ii", &row, &col))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "makeMove expects two integers");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
self->fThis->MakeMove(row, col);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_BASIC_METHOD_DEFINITION(ptTTTGame, showBoard, ShowBoard)
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptTTTGame)
|
||||
PYTHON_METHOD(ptTTTGame, makeMove, "Params: row, col\nMakes a move in the specified spot"),
|
||||
PYTHON_BASIC_METHOD(ptTTTGame, showBoard, "Prints the current board layout to the console"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptTTTGame, pyGameCli, "Game client for the TicTacToe game");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyTTTGame::New(pfGameCli* client)
|
||||
{
|
||||
ptTTTGame *newObj = (ptTTTGame*)ptTTTGame_type.tp_new(&ptTTTGame_type, NULL, NULL);
|
||||
if (client && (client->GetGameTypeId() == kGameTypeId_TicTacToe))
|
||||
newObj->fThis->gameClient = client;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptTTTGame, pyTTTGame)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptTTTGame, pyTTTGame)
|
||||
|
||||
// Module and method definitions
|
||||
void pyTTTGame::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptTTTGame);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
void pyTTTGame::AddPlasmaConstantsClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_ENUM_START(PtTTTGameResult);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTGameResult, kTTTGameResultWinner, kTTTGameResultWinner);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTGameResult, kTTTGameResultTied, kTTTGameResultTied);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTGameResult, kTTTGameResultGave, kTTTGameResultGave);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTGameResult, kTTTGameResultError, kTTTGameResultError);
|
||||
PYTHON_ENUM_END(m, PtTTTGameResult);
|
||||
}
|
||||
|
||||
void pyTTTGame::AddPlasmaMethods(std::vector<PyMethodDef>& methods)
|
||||
{
|
||||
PYTHON_GLOBAL_METHOD(methods, PtIsTTTGame);
|
||||
PYTHON_GLOBAL_METHOD(methods, PtCreateTTTGame);
|
||||
PYTHON_GLOBAL_METHOD(methods, PtJoinCommonTTTGame);
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "pyTTTGame.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyEnum.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base TTT game client class
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptTTTGame, pyTTTGame);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptTTTGame, pyTTTGame)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptTTTGame)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptTTTGame)
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtIsTTTGame, args, "Params: typeID\nReturns true if the specifed typeID (guid as a string) is a TicTacToe game")
|
||||
{
|
||||
PyObject* textObj;
|
||||
if (!PyArg_ParseTuple(args, "O", &textObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtIsTTTGame 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 = pyTTTGame::IsTTTGame(text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
}
|
||||
else if (PyString_Check(textObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(textObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
bool retVal = pyTTTGame::IsTTTGame(wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtIsTTTGame expects a unicode string");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtCreateTTTGame, args, "Params: callbackKey, numPlayers\nCreates a new TicTacToe game with the specified callback key and number of players (1 or 2)")
|
||||
{
|
||||
PyObject* callbackObj = NULL;
|
||||
int numPlayers = 0;
|
||||
if (!PyArg_ParseTuple(args, "Oi", &callbackObj, &numPlayers))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtCreateTTTGame expects a ptKey and an integer");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (!pyKey::Check(callbackObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtCreateTTTGame expects a ptKey and an integer");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyKey* key = pyKey::ConvertFrom(callbackObj);
|
||||
pyTTTGame::CreateTTTGame(*key, numPlayers);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION(PtJoinCommonTTTGame, args, "Params: callbackKey, gameID, numPlayers\nJoins a common TicTacToe game with the specified ID. If one doesn't exist, it creates it with the specified number of players")
|
||||
{
|
||||
PyObject* callbackObj = NULL;
|
||||
int gameID = 0, numPlayers = 0;
|
||||
if (!PyArg_ParseTuple(args, "Oii", &callbackObj, &gameID, &numPlayers))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtJoinCommonTTTGame expects a ptKey and two integers");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
if (!pyKey::Check(callbackObj))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "PtJoinCommonTTTGame expects a ptKey and two integers");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
pyKey* key = pyKey::ConvertFrom(callbackObj);
|
||||
pyTTTGame::JoinCommonTTTGame(*key, gameID, numPlayers);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION(ptTTTGame, makeMove, args)
|
||||
{
|
||||
int row = 0, col = 0;
|
||||
if (!PyArg_ParseTuple(args, "ii", &row, &col))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "makeMove expects two integers");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
self->fThis->MakeMove(row, col);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYTHON_BASIC_METHOD_DEFINITION(ptTTTGame, showBoard, ShowBoard)
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptTTTGame)
|
||||
PYTHON_METHOD(ptTTTGame, makeMove, "Params: row, col\nMakes a move in the specified spot"),
|
||||
PYTHON_BASIC_METHOD(ptTTTGame, showBoard, "Prints the current board layout to the console"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptTTTGame, pyGameCli, "Game client for the TicTacToe game");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyTTTGame::New(pfGameCli* client)
|
||||
{
|
||||
ptTTTGame *newObj = (ptTTTGame*)ptTTTGame_type.tp_new(&ptTTTGame_type, NULL, NULL);
|
||||
if (client && (client->GetGameTypeId() == kGameTypeId_TicTacToe))
|
||||
newObj->fThis->gameClient = client;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptTTTGame, pyTTTGame)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptTTTGame, pyTTTGame)
|
||||
|
||||
// Module and method definitions
|
||||
void pyTTTGame::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptTTTGame);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
void pyTTTGame::AddPlasmaConstantsClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_ENUM_START(PtTTTGameResult);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTGameResult, kTTTGameResultWinner, kTTTGameResultWinner);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTGameResult, kTTTGameResultTied, kTTTGameResultTied);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTGameResult, kTTTGameResultGave, kTTTGameResultGave);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTGameResult, kTTTGameResultError, kTTTGameResultError);
|
||||
PYTHON_ENUM_END(m, PtTTTGameResult);
|
||||
}
|
||||
|
||||
void pyTTTGame::AddPlasmaMethods(std::vector<PyMethodDef>& methods)
|
||||
{
|
||||
PYTHON_GLOBAL_METHOD(methods, PtIsTTTGame);
|
||||
PYTHON_GLOBAL_METHOD(methods, PtCreateTTTGame);
|
||||
PYTHON_GLOBAL_METHOD(methods, PtJoinCommonTTTGame);
|
||||
}
|
@ -1,171 +1,171 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "pyTTTMsg.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base TTT msg class
|
||||
//
|
||||
|
||||
pyTTTMsg::pyTTTMsg(): pyGameCliMsg() {}
|
||||
|
||||
pyTTTMsg::pyTTTMsg(pfGameCliMsg* msg): pyGameCliMsg(msg)
|
||||
{
|
||||
if (message && (message->gameCli->GetGameTypeId() != kGameTypeId_TicTacToe))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
int pyTTTMsg::GetTTTMsgType() const
|
||||
{
|
||||
if (message)
|
||||
return message->netMsg->messageId;
|
||||
return -1;
|
||||
}
|
||||
|
||||
PyObject* pyTTTMsg::UpcastToFinalTTTMsg() const
|
||||
{
|
||||
if (!message)
|
||||
PYTHON_RETURN_NONE;
|
||||
switch (message->netMsg->messageId)
|
||||
{
|
||||
case kSrv2Cli_TTT_GameStarted:
|
||||
return pyTTTGameStartedMsg::New(message);
|
||||
case kSrv2Cli_TTT_GameOver:
|
||||
return pyTTTGameOverMsg::New(message);
|
||||
case kSrv2Cli_TTT_MoveMade:
|
||||
return pyTTTMoveMadeMsg::New(message);
|
||||
default:
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The different messages we can receive
|
||||
//
|
||||
|
||||
pyTTTGameStartedMsg::pyTTTGameStartedMsg(): pyTTTMsg() {}
|
||||
|
||||
pyTTTGameStartedMsg::pyTTTGameStartedMsg(pfGameCliMsg* msg): pyTTTMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_TTT_GameStarted))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
bool pyTTTGameStartedMsg::YourTurn() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_GameStarted* gmMsg = (const Srv2Cli_TTT_GameStarted*)message->netMsg;
|
||||
return gmMsg->yourTurn;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyTTTGameOverMsg::pyTTTGameOverMsg(): pyTTTMsg() {}
|
||||
|
||||
pyTTTGameOverMsg::pyTTTGameOverMsg(pfGameCliMsg* msg): pyTTTMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_TTT_GameOver))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
int pyTTTGameOverMsg::Result() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_GameOver* gmMsg = (const Srv2Cli_TTT_GameOver*)message->netMsg;
|
||||
return gmMsg->result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned long pyTTTGameOverMsg::WinnerID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_GameOver* gmMsg = (const Srv2Cli_TTT_GameOver*)message->netMsg;
|
||||
return gmMsg->winnerId;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyTTTMoveMadeMsg::pyTTTMoveMadeMsg(): pyTTTMsg() {}
|
||||
|
||||
pyTTTMoveMadeMsg::pyTTTMoveMadeMsg(pfGameCliMsg* msg): pyTTTMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_TTT_MoveMade))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyTTTMoveMadeMsg::PlayerID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_MoveMade* gmMsg = (const Srv2Cli_TTT_MoveMade*)message->netMsg;
|
||||
return gmMsg->playerId;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int pyTTTMoveMadeMsg::Row() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_MoveMade* gmMsg = (const Srv2Cli_TTT_MoveMade*)message->netMsg;
|
||||
return gmMsg->row;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int pyTTTMoveMadeMsg::Col() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_MoveMade* gmMsg = (const Srv2Cli_TTT_MoveMade*)message->netMsg;
|
||||
return gmMsg->col;
|
||||
}
|
||||
return false;
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "pyTTTMsg.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base TTT msg class
|
||||
//
|
||||
|
||||
pyTTTMsg::pyTTTMsg(): pyGameCliMsg() {}
|
||||
|
||||
pyTTTMsg::pyTTTMsg(pfGameCliMsg* msg): pyGameCliMsg(msg)
|
||||
{
|
||||
if (message && (message->gameCli->GetGameTypeId() != kGameTypeId_TicTacToe))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
int pyTTTMsg::GetTTTMsgType() const
|
||||
{
|
||||
if (message)
|
||||
return message->netMsg->messageId;
|
||||
return -1;
|
||||
}
|
||||
|
||||
PyObject* pyTTTMsg::UpcastToFinalTTTMsg() const
|
||||
{
|
||||
if (!message)
|
||||
PYTHON_RETURN_NONE;
|
||||
switch (message->netMsg->messageId)
|
||||
{
|
||||
case kSrv2Cli_TTT_GameStarted:
|
||||
return pyTTTGameStartedMsg::New(message);
|
||||
case kSrv2Cli_TTT_GameOver:
|
||||
return pyTTTGameOverMsg::New(message);
|
||||
case kSrv2Cli_TTT_MoveMade:
|
||||
return pyTTTMoveMadeMsg::New(message);
|
||||
default:
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The different messages we can receive
|
||||
//
|
||||
|
||||
pyTTTGameStartedMsg::pyTTTGameStartedMsg(): pyTTTMsg() {}
|
||||
|
||||
pyTTTGameStartedMsg::pyTTTGameStartedMsg(pfGameCliMsg* msg): pyTTTMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_TTT_GameStarted))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
bool pyTTTGameStartedMsg::YourTurn() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_GameStarted* gmMsg = (const Srv2Cli_TTT_GameStarted*)message->netMsg;
|
||||
return gmMsg->yourTurn;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyTTTGameOverMsg::pyTTTGameOverMsg(): pyTTTMsg() {}
|
||||
|
||||
pyTTTGameOverMsg::pyTTTGameOverMsg(pfGameCliMsg* msg): pyTTTMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_TTT_GameOver))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
int pyTTTGameOverMsg::Result() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_GameOver* gmMsg = (const Srv2Cli_TTT_GameOver*)message->netMsg;
|
||||
return gmMsg->result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned long pyTTTGameOverMsg::WinnerID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_GameOver* gmMsg = (const Srv2Cli_TTT_GameOver*)message->netMsg;
|
||||
return gmMsg->winnerId;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
pyTTTMoveMadeMsg::pyTTTMoveMadeMsg(): pyTTTMsg() {}
|
||||
|
||||
pyTTTMoveMadeMsg::pyTTTMoveMadeMsg(pfGameCliMsg* msg): pyTTTMsg(msg)
|
||||
{
|
||||
if (message && (message->netMsg->messageId != kSrv2Cli_TTT_MoveMade))
|
||||
message = nil; // wrong type, just clear it out
|
||||
}
|
||||
|
||||
unsigned long pyTTTMoveMadeMsg::PlayerID() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_MoveMade* gmMsg = (const Srv2Cli_TTT_MoveMade*)message->netMsg;
|
||||
return gmMsg->playerId;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int pyTTTMoveMadeMsg::Row() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_MoveMade* gmMsg = (const Srv2Cli_TTT_MoveMade*)message->netMsg;
|
||||
return gmMsg->row;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int pyTTTMoveMadeMsg::Col() const
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_TTT_MoveMade* gmMsg = (const Srv2Cli_TTT_MoveMade*)message->netMsg;
|
||||
return gmMsg->col;
|
||||
}
|
||||
return false;
|
||||
}
|
@ -1,140 +1,140 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef pyTTTMsg_h
|
||||
#define pyTTTMsg_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: pyTTTMsg
|
||||
//
|
||||
// PURPOSE: Class wrapper for TTT game messages
|
||||
//
|
||||
|
||||
#include "../pfGameMgr/pfGameMgr.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyGlueHelpers.h"
|
||||
#include "../pyGameCliMsg.h"
|
||||
|
||||
class pyTTTMsg : public pyGameCliMsg
|
||||
{
|
||||
protected:
|
||||
pyTTTMsg();
|
||||
pyTTTMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_EXPOSE_TYPE; // so we can subclass
|
||||
PYTHON_CLASS_NEW_FRIEND(ptTTTMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyTTTMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyTTTMsg); // converts a PyObject to a pyTTTMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
static void AddPlasmaConstantsClasses(PyObject* m);
|
||||
|
||||
int GetTTTMsgType() const;
|
||||
|
||||
PyObject* UpcastToFinalTTTMsg() const; // returns the ttt message that this really is
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyTTTGameStartedMsg : public pyTTTMsg
|
||||
{
|
||||
protected:
|
||||
pyTTTGameStartedMsg();
|
||||
pyTTTGameStartedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptTTTGameStartedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyTTTGameStartedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyTTTGameStartedMsg); // converts a PyObject to a pyTTTGameStartedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
bool YourTurn() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyTTTGameOverMsg : public pyTTTMsg
|
||||
{
|
||||
protected:
|
||||
pyTTTGameOverMsg();
|
||||
pyTTTGameOverMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptTTTGameOverMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyTTTGameOverMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyTTTGameOverMsg); // converts a PyObject to a pyTTTGameOverMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
int Result() const;
|
||||
unsigned long WinnerID() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyTTTMoveMadeMsg : public pyTTTMsg
|
||||
{
|
||||
protected:
|
||||
pyTTTMoveMadeMsg();
|
||||
pyTTTMoveMadeMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptTTTMoveMadeMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyTTTMoveMadeMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyTTTMoveMadeMsg); // converts a PyObject to a pyTTTMoveMadeMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long PlayerID() const;
|
||||
int Row() const;
|
||||
int Col() const;
|
||||
};
|
||||
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef pyTTTMsg_h
|
||||
#define pyTTTMsg_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: pyTTTMsg
|
||||
//
|
||||
// PURPOSE: Class wrapper for TTT game messages
|
||||
//
|
||||
|
||||
#include "../pfGameMgr/pfGameMgr.h"
|
||||
|
||||
#include <python.h>
|
||||
#include "../../pyGlueHelpers.h"
|
||||
#include "../pyGameCliMsg.h"
|
||||
|
||||
class pyTTTMsg : public pyGameCliMsg
|
||||
{
|
||||
protected:
|
||||
pyTTTMsg();
|
||||
pyTTTMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_EXPOSE_TYPE; // so we can subclass
|
||||
PYTHON_CLASS_NEW_FRIEND(ptTTTMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyTTTMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyTTTMsg); // converts a PyObject to a pyTTTMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
static void AddPlasmaConstantsClasses(PyObject* m);
|
||||
|
||||
int GetTTTMsgType() const;
|
||||
|
||||
PyObject* UpcastToFinalTTTMsg() const; // returns the ttt message that this really is
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyTTTGameStartedMsg : public pyTTTMsg
|
||||
{
|
||||
protected:
|
||||
pyTTTGameStartedMsg();
|
||||
pyTTTGameStartedMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptTTTGameStartedMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyTTTGameStartedMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyTTTGameStartedMsg); // converts a PyObject to a pyTTTGameStartedMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
bool YourTurn() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyTTTGameOverMsg : public pyTTTMsg
|
||||
{
|
||||
protected:
|
||||
pyTTTGameOverMsg();
|
||||
pyTTTGameOverMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptTTTGameOverMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyTTTGameOverMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyTTTGameOverMsg); // converts a PyObject to a pyTTTGameOverMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
int Result() const;
|
||||
unsigned long WinnerID() const;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class pyTTTMoveMadeMsg : public pyTTTMsg
|
||||
{
|
||||
protected:
|
||||
pyTTTMoveMadeMsg();
|
||||
pyTTTMoveMadeMsg(pfGameCliMsg* msg);
|
||||
|
||||
public:
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptTTTMoveMadeMsg);
|
||||
static PyObject* New(pfGameCliMsg* msg);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyTTTMoveMadeMsg object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyTTTMoveMadeMsg); // converts a PyObject to a pyTTTMoveMadeMsg (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject* m);
|
||||
|
||||
unsigned long PlayerID() const;
|
||||
int Row() const;
|
||||
int Col() const;
|
||||
};
|
||||
|
||||
#endif // pyTTTMsg_h
|
@ -1,247 +1,247 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "pyTTTMsg.h"
|
||||
#include "../../pyEnum.h"
|
||||
|
||||
#include <python.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base TTT msg class
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptTTTMsg, pyTTTMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptTTTMsg, pyTTTMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptTTTMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptTTTMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTMsg, getTTTMsgType)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->GetTTTMsgType());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTMsg, upcastToFinalTTTMsg)
|
||||
{
|
||||
return self->fThis->UpcastToFinalTTTMsg();
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptTTTMsg)
|
||||
PYTHON_METHOD_NOARGS(ptTTTMsg, getTTTMsgType, "Returns the type of the TTT message (see PtTTTMsgTypes)"),
|
||||
PYTHON_METHOD_NOARGS(ptTTTMsg, upcastToFinalTTTMsg, "Returns this message as the TTT msg it is"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptTTTMsg, pyGameCliMsg, "Base class for TicTacToe game messages");
|
||||
PYTHON_EXPOSE_TYPE_DEFINITION(ptTTTMsg, pyTTTMsg);
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyTTTMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptTTTMsg *newObj = (ptTTTMsg*)ptTTTMsg_type.tp_new(&ptTTTMsg_type, NULL, NULL);
|
||||
if (msg && (msg->gameCli->GetGameTypeId() == kGameTypeId_TicTacToe))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptTTTMsg, pyTTTMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptTTTMsg, pyTTTMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyTTTMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptTTTMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
void pyTTTMsg::AddPlasmaConstantsClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_ENUM_START(PtTTTMsgTypes);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTMsgTypes, kTTTGameStarted, kSrv2Cli_TTT_GameStarted);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTMsgTypes, kTTTGameOver, kSrv2Cli_TTT_GameOver);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTMsgTypes, kTTTMoveMade, kSrv2Cli_TTT_MoveMade);
|
||||
PYTHON_ENUM_END(m, PtTTTMsgTypes);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Game client message subclasses
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptTTTGameStartedMsg, pyTTTGameStartedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptTTTGameStartedMsg, pyTTTGameStartedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptTTTGameStartedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptTTTGameStartedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTGameStartedMsg, yourTurn)
|
||||
{
|
||||
PYTHON_RETURN_BOOL(self->fThis->YourTurn());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptTTTGameStartedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptTTTGameStartedMsg, yourTurn, "Returns true if you are the first player (and therefore it's your turn)"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptTTTGameStartedMsg, pyTTTMsg, "TicTacToe message received when the game is started");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyTTTGameStartedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptTTTGameStartedMsg *newObj = (ptTTTGameStartedMsg*)ptTTTGameStartedMsg_type.tp_new(&ptTTTGameStartedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_TTT_GameStarted))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptTTTGameStartedMsg, pyTTTGameStartedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptTTTGameStartedMsg, pyTTTGameStartedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyTTTGameStartedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptTTTGameStartedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptTTTGameOverMsg, pyTTTGameOverMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptTTTGameOverMsg, pyTTTGameOverMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptTTTGameOverMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptTTTGameOverMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTGameOverMsg, result)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->Result());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTGameOverMsg, winnerID)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->WinnerID());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptTTTGameOverMsg)
|
||||
PYTHON_METHOD_NOARGS(ptTTTGameOverMsg, result, "Returns the result of the game (see PtTTTGameResult)"),
|
||||
PYTHON_METHOD_NOARGS(ptTTTGameOverMsg, winnerID, "Returns the winner's ID"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptTTTGameOverMsg, pyTTTMsg, "TicTacToe message received when the game is over");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyTTTGameOverMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptTTTGameOverMsg *newObj = (ptTTTGameOverMsg*)ptTTTGameOverMsg_type.tp_new(&ptTTTGameOverMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_TTT_GameOver))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptTTTGameOverMsg, pyTTTGameOverMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptTTTGameOverMsg, pyTTTGameOverMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyTTTGameOverMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptTTTGameOverMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptTTTMoveMadeMsg, pyTTTMoveMadeMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptTTTMoveMadeMsg, pyTTTMoveMadeMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptTTTMoveMadeMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptTTTMoveMadeMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTMoveMadeMsg, playerID)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->PlayerID());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTMoveMadeMsg, row)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->Row());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTMoveMadeMsg, col)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->Col());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptTTTMoveMadeMsg)
|
||||
PYTHON_METHOD_NOARGS(ptTTTMoveMadeMsg, playerID, "Returns the the ID of the player that just moved"),
|
||||
PYTHON_METHOD_NOARGS(ptTTTMoveMadeMsg, row, "Returns the row index of the move (1..3)"),
|
||||
PYTHON_METHOD_NOARGS(ptTTTMoveMadeMsg, col, "Returns the col index of the move (1..3)"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptTTTMoveMadeMsg, pyTTTMsg, "TicTacToe message received when someone makes a move");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyTTTMoveMadeMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptTTTMoveMadeMsg *newObj = (ptTTTMoveMadeMsg*)ptTTTMoveMadeMsg_type.tp_new(&ptTTTMoveMadeMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_TTT_MoveMade))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptTTTMoveMadeMsg, pyTTTMoveMadeMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptTTTMoveMadeMsg, pyTTTMoveMadeMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyTTTMoveMadeMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptTTTMoveMadeMsg);
|
||||
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/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "pyTTTMsg.h"
|
||||
#include "../../pyEnum.h"
|
||||
|
||||
#include <python.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Base TTT msg class
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptTTTMsg, pyTTTMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptTTTMsg, pyTTTMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptTTTMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptTTTMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTMsg, getTTTMsgType)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->GetTTTMsgType());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTMsg, upcastToFinalTTTMsg)
|
||||
{
|
||||
return self->fThis->UpcastToFinalTTTMsg();
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptTTTMsg)
|
||||
PYTHON_METHOD_NOARGS(ptTTTMsg, getTTTMsgType, "Returns the type of the TTT message (see PtTTTMsgTypes)"),
|
||||
PYTHON_METHOD_NOARGS(ptTTTMsg, upcastToFinalTTTMsg, "Returns this message as the TTT msg it is"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptTTTMsg, pyGameCliMsg, "Base class for TicTacToe game messages");
|
||||
PYTHON_EXPOSE_TYPE_DEFINITION(ptTTTMsg, pyTTTMsg);
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyTTTMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptTTTMsg *newObj = (ptTTTMsg*)ptTTTMsg_type.tp_new(&ptTTTMsg_type, NULL, NULL);
|
||||
if (msg && (msg->gameCli->GetGameTypeId() == kGameTypeId_TicTacToe))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptTTTMsg, pyTTTMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptTTTMsg, pyTTTMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyTTTMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptTTTMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
void pyTTTMsg::AddPlasmaConstantsClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_ENUM_START(PtTTTMsgTypes);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTMsgTypes, kTTTGameStarted, kSrv2Cli_TTT_GameStarted);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTMsgTypes, kTTTGameOver, kSrv2Cli_TTT_GameOver);
|
||||
PYTHON_ENUM_ELEMENT(PtTTTMsgTypes, kTTTMoveMade, kSrv2Cli_TTT_MoveMade);
|
||||
PYTHON_ENUM_END(m, PtTTTMsgTypes);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Game client message subclasses
|
||||
//
|
||||
|
||||
PYTHON_CLASS_DEFINITION(ptTTTGameStartedMsg, pyTTTGameStartedMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptTTTGameStartedMsg, pyTTTGameStartedMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptTTTGameStartedMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptTTTGameStartedMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTGameStartedMsg, yourTurn)
|
||||
{
|
||||
PYTHON_RETURN_BOOL(self->fThis->YourTurn());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptTTTGameStartedMsg)
|
||||
PYTHON_METHOD_NOARGS(ptTTTGameStartedMsg, yourTurn, "Returns true if you are the first player (and therefore it's your turn)"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptTTTGameStartedMsg, pyTTTMsg, "TicTacToe message received when the game is started");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyTTTGameStartedMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptTTTGameStartedMsg *newObj = (ptTTTGameStartedMsg*)ptTTTGameStartedMsg_type.tp_new(&ptTTTGameStartedMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_TTT_GameStarted))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptTTTGameStartedMsg, pyTTTGameStartedMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptTTTGameStartedMsg, pyTTTGameStartedMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyTTTGameStartedMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptTTTGameStartedMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptTTTGameOverMsg, pyTTTGameOverMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptTTTGameOverMsg, pyTTTGameOverMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptTTTGameOverMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptTTTGameOverMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTGameOverMsg, result)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->Result());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTGameOverMsg, winnerID)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->WinnerID());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptTTTGameOverMsg)
|
||||
PYTHON_METHOD_NOARGS(ptTTTGameOverMsg, result, "Returns the result of the game (see PtTTTGameResult)"),
|
||||
PYTHON_METHOD_NOARGS(ptTTTGameOverMsg, winnerID, "Returns the winner's ID"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptTTTGameOverMsg, pyTTTMsg, "TicTacToe message received when the game is over");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyTTTGameOverMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptTTTGameOverMsg *newObj = (ptTTTGameOverMsg*)ptTTTGameOverMsg_type.tp_new(&ptTTTGameOverMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_TTT_GameOver))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptTTTGameOverMsg, pyTTTGameOverMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptTTTGameOverMsg, pyTTTGameOverMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyTTTGameOverMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptTTTGameOverMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
PYTHON_CLASS_DEFINITION(ptTTTMoveMadeMsg, pyTTTMoveMadeMsg);
|
||||
|
||||
PYTHON_DEFAULT_NEW_DEFINITION(ptTTTMoveMadeMsg, pyTTTMoveMadeMsg)
|
||||
PYTHON_DEFAULT_DEALLOC_DEFINITION(ptTTTMoveMadeMsg)
|
||||
|
||||
PYTHON_NO_INIT_DEFINITION(ptTTTMoveMadeMsg)
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTMoveMadeMsg, playerID)
|
||||
{
|
||||
return PyLong_FromUnsignedLong(self->fThis->PlayerID());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTMoveMadeMsg, row)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->Row());
|
||||
}
|
||||
|
||||
PYTHON_METHOD_DEFINITION_NOARGS(ptTTTMoveMadeMsg, col)
|
||||
{
|
||||
return PyInt_FromLong(self->fThis->Col());
|
||||
}
|
||||
|
||||
PYTHON_START_METHODS_TABLE(ptTTTMoveMadeMsg)
|
||||
PYTHON_METHOD_NOARGS(ptTTTMoveMadeMsg, playerID, "Returns the the ID of the player that just moved"),
|
||||
PYTHON_METHOD_NOARGS(ptTTTMoveMadeMsg, row, "Returns the row index of the move (1..3)"),
|
||||
PYTHON_METHOD_NOARGS(ptTTTMoveMadeMsg, col, "Returns the col index of the move (1..3)"),
|
||||
PYTHON_END_METHODS_TABLE;
|
||||
|
||||
// Type structure definition
|
||||
PLASMA_DEFAULT_TYPE_WBASE(ptTTTMoveMadeMsg, pyTTTMsg, "TicTacToe message received when someone makes a move");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject* pyTTTMoveMadeMsg::New(pfGameCliMsg* msg)
|
||||
{
|
||||
ptTTTMoveMadeMsg *newObj = (ptTTTMoveMadeMsg*)ptTTTMoveMadeMsg_type.tp_new(&ptTTTMoveMadeMsg_type, NULL, NULL);
|
||||
if (msg && (msg->netMsg->messageId == kSrv2Cli_TTT_MoveMade))
|
||||
newObj->fThis->message = msg;
|
||||
return (PyObject*)newObj;
|
||||
}
|
||||
|
||||
PYTHON_CLASS_CHECK_IMPL(ptTTTMoveMadeMsg, pyTTTMoveMadeMsg)
|
||||
PYTHON_CLASS_CONVERT_FROM_IMPL(ptTTTMoveMadeMsg, pyTTTMoveMadeMsg)
|
||||
|
||||
// Module and method definitions
|
||||
void pyTTTMoveMadeMsg::AddPlasmaClasses(PyObject* m)
|
||||
{
|
||||
PYTHON_CLASS_IMPORT_START(m);
|
||||
PYTHON_CLASS_IMPORT(m, ptTTTMoveMadeMsg);
|
||||
PYTHON_CLASS_IMPORT_END(m);
|
||||
}
|
Reference in New Issue
Block a user