Fist steps to implement vote kick in network protocol.
This commit is contained in:
@@ -66,6 +66,24 @@ enum PlayerActionCode
|
|||||||
ACTION_CODE_NOT_ALLOWED
|
ACTION_CODE_NOT_ALLOWED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum DenyKickPlayerReason
|
||||||
|
{
|
||||||
|
KICK_DENIED_TEMPORARY,
|
||||||
|
KICK_DENIED_OTHER_IN_PROGRESS
|
||||||
|
};
|
||||||
|
|
||||||
|
enum KickVote
|
||||||
|
{
|
||||||
|
KICK_VOTE_AGAINST,
|
||||||
|
KICK_VOTE_IN_FAVOUR
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DenyVoteReason
|
||||||
|
{
|
||||||
|
VOTE_DENIED_INVALID_PETITION,
|
||||||
|
VOTE_DENIED_ALREADY_VOTED
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
enum Button {
|
enum Button {
|
||||||
BUTTON_NONE = 0,
|
BUTTON_NONE = 0,
|
||||||
|
|||||||
@@ -70,6 +70,14 @@ using namespace std;
|
|||||||
#define NET_TYPE_END_OF_HAND_SHOW_CARDS 0x0064
|
#define NET_TYPE_END_OF_HAND_SHOW_CARDS 0x0064
|
||||||
#define NET_TYPE_END_OF_HAND_HIDE_CARDS 0x0065
|
#define NET_TYPE_END_OF_HAND_HIDE_CARDS 0x0065
|
||||||
#define NET_TYPE_END_OF_GAME 0x0070
|
#define NET_TYPE_END_OF_GAME 0x0070
|
||||||
|
#define NET_TYPE_ASK_KICK_PLAYER 0x0071
|
||||||
|
#define NET_TYPE_ASK_KICK_PLAYER_DENIED 0x0072
|
||||||
|
#define NET_TYPE_START_KICK_PLAYER_PETITION 0x0073
|
||||||
|
#define NET_TYPE_VOTE_KICK_PLAYER 0x0074
|
||||||
|
#define NET_TYPE_VOTE_KICK_PLAYER_ACK 0x0075
|
||||||
|
#define NET_TYPE_VOTE_KICK_PLAYER_DENIED 0x0076
|
||||||
|
#define NET_TYPE_END_KICK_PLAYER_PETITION 0x0077
|
||||||
|
|
||||||
#define NET_TYPE_STATISTICS_CHANGED 0x0080
|
#define NET_TYPE_STATISTICS_CHANGED 0x0080
|
||||||
|
|
||||||
#define NET_TYPE_REMOVED_FROM_GAME 0x0100
|
#define NET_TYPE_REMOVED_FROM_GAME 0x0100
|
||||||
@@ -505,6 +513,60 @@ struct GCC_PACKED NetPacketEndOfGameData
|
|||||||
u_int32_t winnerPlayerId;
|
u_int32_t winnerPlayerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct GCC_PACKED NetPacketAskKickPlayerData
|
||||||
|
{
|
||||||
|
NetPacketHeader head;
|
||||||
|
u_int32_t playerId;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GCC_PACKED NetPacketAskKickPlayerDeniedData
|
||||||
|
{
|
||||||
|
NetPacketHeader head;
|
||||||
|
u_int32_t playerId;
|
||||||
|
u_int16_t denyReason;
|
||||||
|
u_int16_t reserved;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GCC_PACKED StartKickPlayerPetitionData
|
||||||
|
{
|
||||||
|
NetPacketHeader head;
|
||||||
|
u_int32_t petitionId;
|
||||||
|
u_int32_t proposingPlayerId;
|
||||||
|
u_int32_t kickPlayerId;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GCC_PACKED VoteKickPlayerData
|
||||||
|
{
|
||||||
|
NetPacketHeader head;
|
||||||
|
u_int32_t petitionId;
|
||||||
|
u_int16_t vote;
|
||||||
|
u_int16_t reserved;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GCC_PACKED VoteKickPlayerAckData
|
||||||
|
{
|
||||||
|
NetPacketHeader head;
|
||||||
|
u_int32_t petitionId;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GCC_PACKED VoteKickPlayerDeniedData
|
||||||
|
{
|
||||||
|
NetPacketHeader head;
|
||||||
|
u_int32_t petitionId;
|
||||||
|
u_int16_t denyReason;
|
||||||
|
u_int16_t reserved;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GCC_PACKED EndKickPlayerPetitionData
|
||||||
|
{
|
||||||
|
NetPacketHeader head;
|
||||||
|
u_int32_t petitionId;
|
||||||
|
u_int16_t numVotesAgainstKicking;
|
||||||
|
u_int16_t numVotesInFavourOfKicking;
|
||||||
|
u_int16_t voteResult;
|
||||||
|
u_int16_t reserved;
|
||||||
|
};
|
||||||
|
|
||||||
struct GCC_PACKED StatisticsData
|
struct GCC_PACKED StatisticsData
|
||||||
{
|
{
|
||||||
u_int32_t statisticsType;
|
u_int32_t statisticsType;
|
||||||
|
|||||||
@@ -87,6 +87,13 @@ class NetPacketAllInShowCards;
|
|||||||
class NetPacketEndOfHandShowCards;
|
class NetPacketEndOfHandShowCards;
|
||||||
class NetPacketEndOfHandHideCards;
|
class NetPacketEndOfHandHideCards;
|
||||||
class NetPacketEndOfGame;
|
class NetPacketEndOfGame;
|
||||||
|
class NetPacketAskKickPlayer;
|
||||||
|
class NetPacketAskKickPlayerDenied;
|
||||||
|
class NetPacketStartKickPlayerPetition;
|
||||||
|
class NetPacketVoteKickPlayer;
|
||||||
|
class NetPacketVoteKickPlayerAck;
|
||||||
|
class NetPacketVoteKickPlayerDenied;
|
||||||
|
class NetPacketEndKickPlayerPetition;
|
||||||
class NetPacketStatisticsChanged;
|
class NetPacketStatisticsChanged;
|
||||||
class NetPacketRemovedFromGame;
|
class NetPacketRemovedFromGame;
|
||||||
class NetPacketTimeoutWarning;
|
class NetPacketTimeoutWarning;
|
||||||
@@ -153,6 +160,13 @@ public:
|
|||||||
virtual const NetPacketEndOfHandShowCards *ToNetPacketEndOfHandShowCards() const;
|
virtual const NetPacketEndOfHandShowCards *ToNetPacketEndOfHandShowCards() const;
|
||||||
virtual const NetPacketEndOfHandHideCards *ToNetPacketEndOfHandHideCards() const;
|
virtual const NetPacketEndOfHandHideCards *ToNetPacketEndOfHandHideCards() const;
|
||||||
virtual const NetPacketEndOfGame *ToNetPacketEndOfGame() const;
|
virtual const NetPacketEndOfGame *ToNetPacketEndOfGame() const;
|
||||||
|
virtual const NetPacketAskKickPlayer *ToNetPacketAskKickPlayer() const;
|
||||||
|
virtual const NetPacketAskKickPlayerDenied *ToNetPacketAskKickPlayerDenied() const;
|
||||||
|
virtual const NetPacketStartKickPlayerPetition *ToNetPacketStartKickPlayerPetition() const;
|
||||||
|
virtual const NetPacketVoteKickPlayer *ToNetPacketVoteKickPlayer() const;
|
||||||
|
virtual const NetPacketVoteKickPlayerAck *ToNetPacketVoteKickPlayerAck() const;
|
||||||
|
virtual const NetPacketVoteKickPlayerDenied *ToNetPacketVoteKickPlayerDenied() const;
|
||||||
|
virtual const NetPacketEndKickPlayerPetition *ToNetPacketEndKickPlayerPetition() const;
|
||||||
virtual const NetPacketStatisticsChanged *ToNetPacketStatisticsChanged() const;
|
virtual const NetPacketStatisticsChanged *ToNetPacketStatisticsChanged() const;
|
||||||
virtual const NetPacketRemovedFromGame *ToNetPacketRemovedFromGame() const;
|
virtual const NetPacketRemovedFromGame *ToNetPacketRemovedFromGame() const;
|
||||||
virtual const NetPacketTimeoutWarning *ToNetPacketTimeoutWarning() const;
|
virtual const NetPacketTimeoutWarning *ToNetPacketTimeoutWarning() const;
|
||||||
@@ -1172,6 +1186,175 @@ protected:
|
|||||||
virtual void InternalCheck(const NetPacketHeader* data) const;
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NetPacketAskKickPlayer : public NetPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
u_int32_t playerId;
|
||||||
|
};
|
||||||
|
|
||||||
|
NetPacketAskKickPlayer();
|
||||||
|
virtual ~NetPacketAskKickPlayer();
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
||||||
|
|
||||||
|
void SetData(const Data &inData);
|
||||||
|
void GetData(Data &outData) const;
|
||||||
|
|
||||||
|
virtual const NetPacketAskKickPlayer *ToNetPacketAskKickPlayer() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NetPacketAskKickPlayerDenied : public NetPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
u_int32_t playerId;
|
||||||
|
DenyKickPlayerReason denyReason;
|
||||||
|
};
|
||||||
|
|
||||||
|
NetPacketAskKickPlayerDenied();
|
||||||
|
virtual ~NetPacketAskKickPlayerDenied();
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
||||||
|
|
||||||
|
void SetData(const Data &inData);
|
||||||
|
void GetData(Data &outData) const;
|
||||||
|
|
||||||
|
virtual const NetPacketAskKickPlayerDenied *ToNetPacketAskKickPlayerDenied() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NetPacketStartKickPlayerPetition : public NetPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
u_int32_t petitionId;
|
||||||
|
u_int32_t proposingPlayerId;
|
||||||
|
u_int32_t kickPlayerId;
|
||||||
|
};
|
||||||
|
|
||||||
|
NetPacketStartKickPlayerPetition();
|
||||||
|
virtual ~NetPacketStartKickPlayerPetition();
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
||||||
|
|
||||||
|
void SetData(const Data &inData);
|
||||||
|
void GetData(Data &outData) const;
|
||||||
|
|
||||||
|
virtual const NetPacketStartKickPlayerPetition *ToNetPacketStartKickPlayerPetition() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NetPacketVoteKickPlayer : public NetPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
u_int32_t petitionId;
|
||||||
|
KickVote vote;
|
||||||
|
};
|
||||||
|
|
||||||
|
NetPacketVoteKickPlayer();
|
||||||
|
virtual ~NetPacketVoteKickPlayer();
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
||||||
|
|
||||||
|
void SetData(const Data &inData);
|
||||||
|
void GetData(Data &outData) const;
|
||||||
|
|
||||||
|
virtual const NetPacketVoteKickPlayer *ToNetPacketVoteKickPlayer() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NetPacketVoteKickPlayerAck : public NetPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
u_int32_t petitionId;
|
||||||
|
};
|
||||||
|
|
||||||
|
NetPacketVoteKickPlayerAck();
|
||||||
|
virtual ~NetPacketVoteKickPlayerAck();
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
||||||
|
|
||||||
|
void SetData(const Data &inData);
|
||||||
|
void GetData(Data &outData) const;
|
||||||
|
|
||||||
|
virtual const NetPacketVoteKickPlayerAck *ToNetPacketVoteKickPlayerAck() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NetPacketVoteKickPlayerDenied : public NetPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
u_int32_t petitionId;
|
||||||
|
DenyVoteReason denyReason;
|
||||||
|
};
|
||||||
|
|
||||||
|
NetPacketVoteKickPlayerDenied();
|
||||||
|
virtual ~NetPacketVoteKickPlayerDenied();
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
||||||
|
|
||||||
|
void SetData(const Data &inData);
|
||||||
|
void GetData(Data &outData) const;
|
||||||
|
|
||||||
|
virtual const NetPacketVoteKickPlayerDenied *ToNetPacketVoteKickPlayerDenied() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NetPacketEndKickPlayerPetition : public NetPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
u_int32_t petitionId;
|
||||||
|
u_int16_t numVotesAgainstKicking;
|
||||||
|
u_int16_t numVotesInFavourOfKicking;
|
||||||
|
bool playerKicked;
|
||||||
|
};
|
||||||
|
|
||||||
|
NetPacketEndKickPlayerPetition();
|
||||||
|
virtual ~NetPacketEndKickPlayerPetition();
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<NetPacket> Clone() const;
|
||||||
|
|
||||||
|
void SetData(const Data &inData);
|
||||||
|
void GetData(Data &outData) const;
|
||||||
|
|
||||||
|
virtual const NetPacketEndKickPlayerPetition *ToNetPacketEndKickPlayerPetition() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void InternalCheck(const NetPacketHeader* data) const;
|
||||||
|
};
|
||||||
|
|
||||||
class NetPacketStatisticsChanged : public NetPacket
|
class NetPacketStatisticsChanged : public NetPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user