• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libkdegames/kgame

kgamemessage.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE games library
00003     Copyright (C) 2001 Martin Heni (kde at 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., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
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 // please document every new id with a short comment
00140   enum GameMessageIds {
00141 // game init, game load, disconnect, ...
00142     IdSetupGame=1,         // sent to a newly connected player
00143     IdSetupGameContinue=2, // continue the setup
00144     IdGameLoad=3,          // load/save the game to the client
00145     IdGameConnected=4,     // Client successfully connected to master
00146     IdSyncRandom=5,        // new random seed set - sync games
00147     IdDisconnect=6,        // KGame object disconnects from game
00148     IdGameSetupDone=7,     // New game client is now operational
00149 
00150 // properties
00151     IdPlayerProperty=20,   // a player property changed
00152     IdGameProperty=21,     // a game property changed
00153 
00154 // player management
00155     IdAddPlayer=30,         // add a player
00156     IdRemovePlayer=31,      // the player will be removed
00157     IdActivatePlayer=32,    // Activate a player
00158     IdInactivatePlayer=33,  // Inactivate a player
00159     IdTurn=34,              // Turn to be prepared
00160 
00161 // to-be-categorized
00162     IdError=100,            // an error occurred
00163     IdPlayerInput=101,      // a player input occurred
00164     IdIOAdded=102,          // KGameIO got added to a player...init this IO
00165 
00166 // special ids for computer player
00167     IdProcessQuery=220,     // Process queries data (process only)
00168     IdPlayerId=221,         // PlayerId got changed (process only)
00169 
00170     IdUser=256          // a user specified message
00171   };
00172 };
00173 
00174 #endif

libkdegames/kgame

Skip menu "libkdegames/kgame"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal