libkdegames Library API Documentation

kgamemessage.h

00001 /* 00002 This file is part of the KDE games library 00003 Copyright (C) 2001 Martin Heni (martin@heni-online.de) 00004 Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de) 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 /* 00021 $Id: kgamemessage.h,v 1.17 2003/07/01 00:31:38 mueller Exp $ 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 // please document every new id with a short comment 00138 enum GameMessageIds { 00139 // game init, game load, disconnect, ... 00140 IdSetupGame=1, // sent to a newly connected player 00141 IdSetupGameContinue=2, // continue the setup 00142 IdGameLoad=3, // load/save the game to the client 00143 IdGameConnected=4, // Client successfully connected to master 00144 IdSyncRandom=5, // new random seed set - sync games 00145 IdDisconnect=6, // KGame object disconnects from game 00146 IdGameSetupDone=7, // New game client is now operational 00147 00148 // properties 00149 IdPlayerProperty=20, // a player property changed 00150 IdGameProperty=21, // a game property changed 00151 00152 // player management 00153 IdAddPlayer=30, // add a player 00154 IdRemovePlayer=31, // the player will be removed 00155 IdActivatePlayer=32, // Activate a player 00156 IdInactivatePlayer=33, // Inactivate a player 00157 IdTurn=34, // Turn to be prepared 00158 00159 // to-be-categorized 00160 IdError=100, // an error occurred 00161 IdPlayerInput=101, // a player input occurred 00162 IdIOAdded=102, // KGameIO got added to a player...init this IO 00163 00164 // special ids for computer player 00165 IdProcessQuery=220, // Process queries data (process only) 00166 IdPlayerId=221, // PlayerId got changed (process only) 00167 00168 IdUser=256 // a user specified message 00169 }; 00170 }; 00171 00172 #endif
KDE Logo
This file is part of the documentation for libkdegames Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 14:18:46 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003