2007-02-25 23:16:26 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
* Copyright (C) 2007 by Lothar May *
|
|
|
|
|
* *
|
|
|
|
|
* 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 2 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, write to the *
|
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
/* PokerTH network packet. */
|
|
|
|
|
|
|
|
|
|
#ifndef _NETPACKET_H_
|
|
|
|
|
#define _NETPACKET_H_
|
|
|
|
|
|
2007-04-26 21:11:13 +00:00
|
|
|
#include <playerdata.h>
|
2007-05-08 22:08:00 +00:00
|
|
|
#include <game_defs.h>
|
2007-04-27 21:35:18 +00:00
|
|
|
#include <gamedata.h>
|
2007-02-25 23:16:26 +00:00
|
|
|
#include <net/socket_helper.h>
|
|
|
|
|
|
2007-07-24 14:55:14 +00:00
|
|
|
#define NET_VERSION_MAJOR 2
|
2007-04-28 13:07:06 +00:00
|
|
|
#define NET_VERSION_MINOR 0
|
|
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
#define MIN_PACKET_SIZE 4
|
|
|
|
|
#define MAX_PACKET_SIZE 256
|
|
|
|
|
#define MAX_NAME_SIZE 64
|
|
|
|
|
#define MAX_PASSWORD_SIZE 64
|
2007-05-25 16:03:12 +00:00
|
|
|
#define MAX_CHAT_TEXT_SIZE 128
|
2007-05-26 17:06:03 +00:00
|
|
|
#define MAX_NUM_PLAYER_RESULTS MAX_NUMBER_OF_PLAYERS
|
2007-06-05 23:04:51 +00:00
|
|
|
#define MAX_NUM_PLAYER_CARDS MAX_NUMBER_OF_PLAYERS
|
2007-03-13 02:23:12 +00:00
|
|
|
|
2007-02-25 23:16:26 +00:00
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
struct NetPacketHeader;
|
2007-03-20 02:20:50 +00:00
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
class NetPacketJoinGame;
|
|
|
|
|
class NetPacketJoinGameAck;
|
2007-05-06 23:27:08 +00:00
|
|
|
class NetPacketPlayerJoined;
|
|
|
|
|
class NetPacketPlayerLeft;
|
2007-08-02 20:52:13 +00:00
|
|
|
class NetPacketKickPlayer;
|
|
|
|
|
class NetPacketStartEvent;
|
2007-05-08 22:08:00 +00:00
|
|
|
class NetPacketGameStart;
|
2007-05-13 17:50:48 +00:00
|
|
|
class NetPacketHandStart;
|
2007-05-08 22:08:00 +00:00
|
|
|
class NetPacketPlayersTurn;
|
|
|
|
|
class NetPacketPlayersAction;
|
2007-05-21 22:16:32 +00:00
|
|
|
class NetPacketPlayersActionDone;
|
2007-05-08 22:08:00 +00:00
|
|
|
class NetPacketPlayersActionRejected;
|
2007-05-25 18:28:05 +00:00
|
|
|
class NetPacketDealFlopCards;
|
|
|
|
|
class NetPacketDealTurnCard;
|
|
|
|
|
class NetPacketDealRiverCard;
|
2007-06-05 23:04:51 +00:00
|
|
|
class NetPacketAllInShowCards;
|
2007-05-26 17:06:03 +00:00
|
|
|
class NetPacketEndOfHandShowCards;
|
|
|
|
|
class NetPacketEndOfHandHideCards;
|
2007-06-10 23:28:25 +00:00
|
|
|
class NetPacketEndOfGame;
|
2007-05-25 16:03:12 +00:00
|
|
|
class NetPacketSendChatText;
|
|
|
|
|
class NetPacketChatText;
|
2007-04-28 13:07:06 +00:00
|
|
|
class NetPacketError;
|
2007-02-25 23:16:26 +00:00
|
|
|
|
|
|
|
|
class NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
2007-04-08 16:18:20 +00:00
|
|
|
static boost::shared_ptr<NetPacket> Create(char *data, unsigned &dataSize);
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
NetPacket(u_int16_t type, u_int16_t initialSize, u_int16_t maxSize);
|
2007-02-25 23:16:26 +00:00
|
|
|
virtual ~NetPacket();
|
|
|
|
|
|
2007-03-20 11:56:30 +00:00
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const = 0;
|
|
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
const NetPacketHeader *GetRawData() const;
|
|
|
|
|
NetPacketHeader *GetRawData();
|
|
|
|
|
void SetRawData(const NetPacketHeader *p);
|
2007-03-20 02:20:50 +00:00
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
u_int16_t GetType() const;
|
|
|
|
|
u_int16_t GetLen() const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketJoinGame *ToNetPacketJoinGame() const;
|
|
|
|
|
virtual const NetPacketJoinGameAck *ToNetPacketJoinGameAck() const;
|
2007-05-06 23:27:08 +00:00
|
|
|
virtual const NetPacketPlayerJoined *ToNetPacketPlayerJoined() const;
|
|
|
|
|
virtual const NetPacketPlayerLeft *ToNetPacketPlayerLeft() const;
|
2007-08-02 20:52:13 +00:00
|
|
|
virtual const NetPacketKickPlayer *ToNetPacketKickPlayer() const;
|
|
|
|
|
virtual const NetPacketStartEvent *ToNetPacketStartEvent() const;
|
2007-05-08 22:08:00 +00:00
|
|
|
virtual const NetPacketGameStart *ToNetPacketGameStart() const;
|
2007-05-13 17:50:48 +00:00
|
|
|
virtual const NetPacketHandStart *ToNetPacketHandStart() const;
|
2007-05-08 22:08:00 +00:00
|
|
|
virtual const NetPacketPlayersTurn *ToNetPacketPlayersTurn() const;
|
|
|
|
|
virtual const NetPacketPlayersAction *ToNetPacketPlayersAction() const;
|
2007-05-21 22:16:32 +00:00
|
|
|
virtual const NetPacketPlayersActionDone *ToNetPacketPlayersActionDone() const;
|
2007-05-08 22:08:00 +00:00
|
|
|
virtual const NetPacketPlayersActionRejected *ToNetPacketPlayersActionRejected() const;
|
2007-05-25 18:28:05 +00:00
|
|
|
virtual const NetPacketDealFlopCards *ToNetPacketDealFlopCards() const;
|
|
|
|
|
virtual const NetPacketDealTurnCard *ToNetPacketDealTurnCard() const;
|
|
|
|
|
virtual const NetPacketDealRiverCard *ToNetPacketDealRiverCard() const;
|
2007-06-05 23:04:51 +00:00
|
|
|
virtual const NetPacketAllInShowCards *ToNetPacketAllInShowCards() const;
|
2007-05-26 17:06:03 +00:00
|
|
|
virtual const NetPacketEndOfHandShowCards *ToNetPacketEndOfHandShowCards() const;
|
|
|
|
|
virtual const NetPacketEndOfHandHideCards *ToNetPacketEndOfHandHideCards() const;
|
2007-06-10 23:28:25 +00:00
|
|
|
virtual const NetPacketEndOfGame *ToNetPacketEndOfGame() const;
|
2007-05-25 16:03:12 +00:00
|
|
|
virtual const NetPacketSendChatText *ToNetPacketSendChatText() const;
|
|
|
|
|
virtual const NetPacketChatText *ToNetPacketChatText() const;
|
2007-04-28 13:07:06 +00:00
|
|
|
virtual const NetPacketError *ToNetPacketError() const;
|
2007-04-08 16:18:20 +00:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
void Check(const NetPacketHeader *data) const;
|
|
|
|
|
virtual void InternalCheck(const NetPacketHeader *data) const = 0;
|
2007-04-08 16:18:20 +00:00
|
|
|
|
|
|
|
|
void Resize(u_int16_t newLen);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
NetPacketHeader *m_data;
|
2007-07-29 23:45:10 +00:00
|
|
|
const u_int16_t m_initialSize;
|
|
|
|
|
const u_int16_t m_maxSize;
|
2007-02-25 23:16:26 +00:00
|
|
|
};
|
|
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
class NetPacketJoinGame : public NetPacket
|
2007-02-25 23:16:26 +00:00
|
|
|
{
|
|
|
|
|
public:
|
2007-04-08 16:18:20 +00:00
|
|
|
struct Data
|
|
|
|
|
{
|
2007-04-28 13:07:06 +00:00
|
|
|
int versionMajor;
|
|
|
|
|
int versionMinor;
|
2007-04-08 16:18:20 +00:00
|
|
|
std::string playerName;
|
|
|
|
|
std::string password;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketJoinGame();
|
|
|
|
|
virtual ~NetPacketJoinGame();
|
2007-02-25 23:16:26 +00:00
|
|
|
|
2007-03-20 11:56:30 +00:00
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
2007-02-25 23:16:26 +00:00
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
virtual const NetPacketJoinGame *ToNetPacketJoinGame() const;
|
2007-03-20 02:20:50 +00:00
|
|
|
|
2007-02-25 23:16:26 +00:00
|
|
|
protected:
|
2007-03-20 02:20:50 +00:00
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-03-20 02:20:50 +00:00
|
|
|
};
|
|
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
class NetPacketJoinGameAck : public NetPacket
|
2007-03-20 02:20:50 +00:00
|
|
|
{
|
|
|
|
|
public:
|
2007-04-08 16:18:20 +00:00
|
|
|
struct Data
|
|
|
|
|
{
|
2007-07-30 23:22:58 +00:00
|
|
|
u_int32_t sessionId;
|
|
|
|
|
u_int16_t yourPlayerUniqueId;
|
|
|
|
|
PlayerType ptype;
|
|
|
|
|
PlayerRights prights;
|
|
|
|
|
GameData gameData;
|
2007-04-08 16:18:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketJoinGameAck();
|
|
|
|
|
virtual ~NetPacketJoinGameAck();
|
2007-03-20 02:20:50 +00:00
|
|
|
|
2007-03-20 11:56:30 +00:00
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
2007-03-20 02:20:50 +00:00
|
|
|
|
2007-04-08 16:18:20 +00:00
|
|
|
virtual const NetPacketJoinGameAck *ToNetPacketJoinGameAck() const;
|
2007-03-20 02:20:50 +00:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-04-08 16:18:20 +00:00
|
|
|
};
|
|
|
|
|
|
2007-05-06 23:27:08 +00:00
|
|
|
class NetPacketPlayerJoined : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
2007-07-30 23:22:58 +00:00
|
|
|
u_int16_t playerId;
|
|
|
|
|
PlayerType ptype;
|
|
|
|
|
PlayerRights prights;
|
|
|
|
|
std::string playerName;
|
2007-05-06 23:27:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketPlayerJoined();
|
|
|
|
|
virtual ~NetPacketPlayerJoined();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketPlayerJoined *ToNetPacketPlayerJoined() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-06 23:27:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketPlayerLeft : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
u_int16_t playerId;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketPlayerLeft();
|
|
|
|
|
virtual ~NetPacketPlayerLeft();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketPlayerLeft *ToNetPacketPlayerLeft() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-06 23:27:08 +00:00
|
|
|
};
|
|
|
|
|
|
2007-08-02 20:52:13 +00:00
|
|
|
class NetPacketKickPlayer : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
u_int16_t playerId;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketKickPlayer();
|
|
|
|
|
virtual ~NetPacketKickPlayer();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketKickPlayer *ToNetPacketKickPlayer() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketStartEvent : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
NetPacketStartEvent();
|
|
|
|
|
virtual ~NetPacketStartEvent();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketStartEvent *ToNetPacketStartEvent() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
|
|
|
|
};
|
|
|
|
|
|
2007-05-08 22:08:00 +00:00
|
|
|
class NetPacketGameStart : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
2007-07-24 14:55:14 +00:00
|
|
|
|
|
|
|
|
struct PlayerSlot
|
|
|
|
|
{
|
|
|
|
|
unsigned playerId;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef std::list<PlayerSlot> PlayerSlotList;
|
|
|
|
|
|
2007-05-08 22:08:00 +00:00
|
|
|
struct Data
|
|
|
|
|
{
|
2007-07-24 14:55:14 +00:00
|
|
|
StartData startData;
|
|
|
|
|
PlayerSlotList playerSlots;
|
2007-05-08 22:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketGameStart();
|
|
|
|
|
virtual ~NetPacketGameStart();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketGameStart *ToNetPacketGameStart() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-13 17:50:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketHandStart : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
u_int16_t yourCards[2];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketHandStart();
|
|
|
|
|
virtual ~NetPacketHandStart();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketHandStart *ToNetPacketHandStart() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-08 22:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketPlayersTurn : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
GameState gameState;
|
|
|
|
|
u_int16_t playerId;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketPlayersTurn();
|
|
|
|
|
virtual ~NetPacketPlayersTurn();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketPlayersTurn *ToNetPacketPlayersTurn() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-08 22:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketPlayersAction : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
GameState gameState;
|
|
|
|
|
PlayerAction playerAction;
|
2007-05-23 22:31:56 +00:00
|
|
|
u_int32_t playerBet;
|
2007-05-08 22:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketPlayersAction();
|
|
|
|
|
virtual ~NetPacketPlayersAction();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketPlayersAction *ToNetPacketPlayersAction() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-21 22:16:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketPlayersActionDone : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
GameState gameState;
|
|
|
|
|
u_int16_t playerId;
|
|
|
|
|
PlayerAction playerAction;
|
2007-05-24 20:26:23 +00:00
|
|
|
u_int32_t totalPlayerBet;
|
|
|
|
|
u_int32_t playerMoney;
|
2007-05-21 22:16:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketPlayersActionDone();
|
|
|
|
|
virtual ~NetPacketPlayersActionDone();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketPlayersActionDone *ToNetPacketPlayersActionDone() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-08 22:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketPlayersActionRejected : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
GameState gameState;
|
|
|
|
|
PlayerAction playerAction;
|
2007-05-23 22:31:56 +00:00
|
|
|
u_int32_t playerBet;
|
2007-05-08 22:08:00 +00:00
|
|
|
int rejectionReason;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketPlayersActionRejected();
|
|
|
|
|
virtual ~NetPacketPlayersActionRejected();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketPlayersActionRejected *ToNetPacketPlayersActionRejected() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-08 22:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
2007-05-25 18:28:05 +00:00
|
|
|
class NetPacketDealFlopCards : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
u_int16_t flopCards[3];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketDealFlopCards();
|
|
|
|
|
virtual ~NetPacketDealFlopCards();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketDealFlopCards *ToNetPacketDealFlopCards() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-25 18:28:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketDealTurnCard : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
u_int16_t turnCard;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketDealTurnCard();
|
|
|
|
|
virtual ~NetPacketDealTurnCard();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketDealTurnCard *ToNetPacketDealTurnCard() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-25 18:28:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketDealRiverCard : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
u_int16_t riverCard;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketDealRiverCard();
|
|
|
|
|
virtual ~NetPacketDealRiverCard();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketDealRiverCard *ToNetPacketDealRiverCard() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-25 18:28:05 +00:00
|
|
|
};
|
|
|
|
|
|
2007-06-05 23:04:51 +00:00
|
|
|
class NetPacketAllInShowCards : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct PlayerCards
|
|
|
|
|
{
|
|
|
|
|
u_int16_t playerId;
|
|
|
|
|
u_int16_t cards[2];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef std::list<PlayerCards> PlayerCardsList;
|
|
|
|
|
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
PlayerCardsList playerCards;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketAllInShowCards();
|
|
|
|
|
virtual ~NetPacketAllInShowCards();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketAllInShowCards *ToNetPacketAllInShowCards() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-06-05 23:04:51 +00:00
|
|
|
};
|
|
|
|
|
|
2007-05-26 17:06:03 +00:00
|
|
|
class NetPacketEndOfHandShowCards : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct PlayerResult
|
|
|
|
|
{
|
|
|
|
|
u_int16_t playerId;
|
|
|
|
|
u_int16_t cards[2];
|
|
|
|
|
u_int16_t bestHandPos[5];
|
|
|
|
|
u_int32_t valueOfCards;
|
|
|
|
|
u_int32_t moneyWon;
|
|
|
|
|
u_int32_t playerMoney;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef std::list<PlayerResult> PlayerResultList;
|
|
|
|
|
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
PlayerResultList playerResults;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketEndOfHandShowCards();
|
|
|
|
|
virtual ~NetPacketEndOfHandShowCards();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketEndOfHandShowCards *ToNetPacketEndOfHandShowCards() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-26 17:06:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketEndOfHandHideCards : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
u_int16_t playerId;
|
|
|
|
|
u_int32_t moneyWon;
|
|
|
|
|
u_int32_t playerMoney;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketEndOfHandHideCards();
|
|
|
|
|
virtual ~NetPacketEndOfHandHideCards();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketEndOfHandHideCards *ToNetPacketEndOfHandHideCards() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-26 17:06:03 +00:00
|
|
|
};
|
|
|
|
|
|
2007-06-10 23:28:25 +00:00
|
|
|
class NetPacketEndOfGame : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
u_int16_t winnerPlayerId;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketEndOfGame();
|
|
|
|
|
virtual ~NetPacketEndOfGame();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketEndOfGame *ToNetPacketEndOfGame() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-06-10 23:28:25 +00:00
|
|
|
};
|
|
|
|
|
|
2007-05-25 16:03:12 +00:00
|
|
|
class NetPacketSendChatText : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
std::string text;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketSendChatText();
|
|
|
|
|
virtual ~NetPacketSendChatText();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketSendChatText *ToNetPacketSendChatText() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-25 16:03:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetPacketChatText : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
u_int16_t playerId;
|
|
|
|
|
std::string text;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketChatText();
|
|
|
|
|
virtual ~NetPacketChatText();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketChatText *ToNetPacketChatText() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-05-25 16:03:12 +00:00
|
|
|
};
|
|
|
|
|
|
2007-04-28 13:07:06 +00:00
|
|
|
class NetPacketError : public NetPacket
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
struct Data
|
|
|
|
|
{
|
|
|
|
|
int errorCode;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NetPacketError();
|
|
|
|
|
virtual ~NetPacketError();
|
|
|
|
|
|
|
|
|
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
|
|
|
|
|
|
|
|
|
void SetData(const Data &inData);
|
|
|
|
|
void GetData(Data &outData) const;
|
|
|
|
|
|
|
|
|
|
virtual const NetPacketError *ToNetPacketError() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2007-07-29 23:45:10 +00:00
|
|
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
2007-04-28 13:07:06 +00:00
|
|
|
};
|
|
|
|
|
|
2007-02-25 23:16:26 +00:00
|
|
|
#endif
|
|
|
|
|
|