kgamemessage.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#ifndef __KGAMEMSG_H_
00024
#define __KGAMEMSG_H_
00025
00026
#include <qdatastream.h>
00027
00028
class KGameMessage
00029 {
00030
public:
00043
static Q_UINT32 createPlayerId(
int player, Q_UINT32 game);
00044
00053
static int rawPlayerId(Q_UINT32 playerid);
00054
00062
static Q_UINT32 rawGameId(Q_UINT32 playerid);
00063
00070
static bool isPlayer(Q_UINT32
id);
00071
00078
static bool isGame(Q_UINT32
id);
00079
00087
static void createHeader(
QDataStream &msg, Q_UINT32 sender, Q_UINT32 receiver,
int msgid);
00088
00094
static void extractHeader(
QDataStream &msg,Q_UINT32 &sender, Q_UINT32 &receiver,
int &msgid);
00095
00099
static void createPropertyHeader(
QDataStream &msg,
int id);
00100
00104
static void extractPropertyHeader(
QDataStream &msg,
int &
id);
00105
00109
static void createPropertyCommand(
QDataStream &msg,
int cmdid,
int pid,
int cmd);
00110
00114
static void extractPropertyCommand(
QDataStream &msg,
int &pid,
int &cmd);
00115
00119
static int version();
00120
00129
static QString messageId2Text(
int msgid);
00130
00131
00137
00138
enum GameMessageIds {
00139
00140 IdSetupGame=1,
00141 IdSetupGameContinue=2,
00142 IdGameLoad=3,
00143 IdGameConnected=4,
00144 IdSyncRandom=5,
00145 IdDisconnect=6,
00146 IdGameSetupDone=7,
00147
00148
00149 IdPlayerProperty=20,
00150 IdGameProperty=21,
00151
00152
00153 IdAddPlayer=30,
00154 IdRemovePlayer=31,
00155 IdActivatePlayer=32,
00156 IdInactivatePlayer=33,
00157 IdTurn=34,
00158
00159
00160 IdError=100,
00161 IdPlayerInput=101,
00162 IdIOAdded=102,
00163
00164
00165 IdProcessQuery=220,
00166 IdPlayerId=221,
00167
00168 IdUser=256
00169 };
00170 };
00171
00172
#endif
This file is part of the documentation for libkdegames Library Version 3.3.0.