some server code

This commit is contained in:
Max-Wilhelm Bruker 2009-11-02 17:35:51 +01:00
parent 6923c98dc2
commit 29bf3d3774
18 changed files with 729 additions and 137 deletions

View file

@ -4,10 +4,10 @@
#include <QObject>
#include <QPair>
#include "server.h"
#include "protocol.h"
#include "protocol_items.h"
class Server_Player;
class Command;
class ProtocolItem;
class Server_ProtocolHandler : public QObject {
Q_OBJECT
@ -23,6 +23,40 @@ private:
AuthenticationResult authState;
bool acceptsGameListChanges;
bool acceptsChatChannelListChanges;
ProtocolResponse::ResponseCode cmdPing(Command_Ping *cmd);
ProtocolResponse::ResponseCode cmdLogin(Command_Login *cmd);
ProtocolResponse::ResponseCode cmdChatListChannels(Command_ChatListChannels *cmd);
ProtocolResponse::ResponseCode cmdChatJoinChannel(Command_ChatJoinChannel *cmd);
ProtocolResponse::ResponseCode cmdChatLeaveChannel(Command_ChatLeaveChannel *cmd, Server_ChatChannel *channel);
ProtocolResponse::ResponseCode cmdChatSay(Command_ChatSay *cmd, Server_ChatChannel *channel);
ProtocolResponse::ResponseCode cmdListGames(Command_ListGames *cmd);
ProtocolResponse::ResponseCode cmdCreateGame(Command_CreateGame *cmd);
ProtocolResponse::ResponseCode cmdJoinGame(Command_JoinGame *cmd);
ProtocolResponse::ResponseCode cmdLeaveGame(Command_LeaveGame *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdSay(Command_Say *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdShuffle(Command_Shuffle *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdRollDie(Command_RollDie *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdDrawCards(Command_DrawCards *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdMoveCard(Command_MoveCard *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdCreateToken(Command_CreateToken *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdCreateArrow(Command_CreateArrow *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdDeleteArrow(Command_DeleteArrow *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdSetCardAttr(Command_SetCardAttr *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdReadyStart(Command_ReadyStart *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdIncCounter(Command_IncCounter *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdAddCounter(Command_AddCounter *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdSetCounter(Command_SetCounter *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdDelCounter(Command_DelCounter *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdNextTurn(Command_NextTurn *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdSetActivePhase(Command_SetActivePhase *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdDumpZone(Command_DumpZone *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdStopDumpZone(Command_StopDumpZone *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdDumpAll(Command_DumpAll *cmd, Server_Game *game, Server_Player *player);
ProtocolResponse::ResponseCode cmdSubmitDeck(Command_SubmitDeck *cmd, Server_Game *game, Server_Player *player);
QList<ProtocolItem *> itemQueue;
void enqueueProtocolItem(ProtocolItem *item);
public:
Server_ProtocolHandler(Server *_server, QObject *parent = 0);
~Server_ProtocolHandler();