libkdegames/kgame
kgamemessage.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __KGAMEMESSAGE_H_
00022 #define __KGAMEMESSAGE_H_
00023
00024 #include <QtCore/QDataStream>
00025 #include <libkdegames_export.h>
00026
00030 class KDEGAMES_EXPORT KGameMessage
00031 {
00032 public:
00045 static quint32 createPlayerId(int player, quint32 game);
00046
00055 static int rawPlayerId(quint32 playerid);
00056
00064 static quint32 rawGameId(quint32 playerid);
00065
00072 static bool isPlayer(quint32 id);
00073
00080 static bool isGame(quint32 id);
00081
00089 static void createHeader(QDataStream &msg, quint32 sender, quint32 receiver, int msgid);
00090
00096 static void extractHeader(QDataStream &msg,quint32 &sender, quint32 &receiver, int &msgid);
00097
00101 static void createPropertyHeader(QDataStream &msg, int id);
00102
00106 static void extractPropertyHeader(QDataStream &msg, int &id);
00107
00111 static void createPropertyCommand(QDataStream &msg, int cmdid, int pid, int cmd);
00112
00116 static void extractPropertyCommand(QDataStream &msg, int &pid, int &cmd);
00117
00121 static int version();
00122
00131 static QString messageId2Text(int msgid);
00132
00133
00139
00140 enum GameMessageIds {
00141
00142 IdSetupGame=1,
00143 IdSetupGameContinue=2,
00144 IdGameLoad=3,
00145 IdGameConnected=4,
00146 IdSyncRandom=5,
00147 IdDisconnect=6,
00148 IdGameSetupDone=7,
00149
00150
00151 IdPlayerProperty=20,
00152 IdGameProperty=21,
00153
00154
00155 IdAddPlayer=30,
00156 IdRemovePlayer=31,
00157 IdActivatePlayer=32,
00158 IdInactivatePlayer=33,
00159 IdTurn=34,
00160
00161
00162 IdError=100,
00163 IdPlayerInput=101,
00164 IdIOAdded=102,
00165
00166
00167 IdProcessQuery=220,
00168 IdPlayerId=221,
00169
00170 IdUser=256
00171 };
00172 };
00173
00174 #endif