• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdegames
 

libtdegames

  • libtdegames
  • kgame
kgamemessage.h
1/*
2 This file is part of the TDE games library
3 Copyright (C) 2001 Martin Heni (martin@heni-online.de)
4 Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20/*
21 $Id$
22*/
23#ifndef __KGAMEMSG_H_
24#define __KGAMEMSG_H_
25
26#include <tqdatastream.h>
27#include <tdemacros.h>
28
29class TDE_EXPORT KGameMessage
30{
31 public:
44 static TQ_UINT32 createPlayerId(int player, TQ_UINT32 game);
45
54 static int rawPlayerId(TQ_UINT32 playerid);
55
63 static TQ_UINT32 rawGameId(TQ_UINT32 playerid);
64
71 static bool isPlayer(TQ_UINT32 id);
72
79 static bool isGame(TQ_UINT32 id);
80
88 static void createHeader(TQDataStream &msg, TQ_UINT32 sender, TQ_UINT32 receiver, int msgid);
89
95 static void extractHeader(TQDataStream &msg,TQ_UINT32 &sender, TQ_UINT32 &receiver, int &msgid);
96
100 static void createPropertyHeader(TQDataStream &msg, int id);
101
105 static void extractPropertyHeader(TQDataStream &msg, int &id);
106
110 static void createPropertyCommand(TQDataStream &msg, int cmdid, int pid, int cmd);
111
115 static void extractPropertyCommand(TQDataStream &msg, int &pid, int &cmd);
116
120 static int version();
121
130 static TQString messageId2Text(int msgid);
131
132
138// please document every new id with a short comment
139 enum GameMessageIds {
140// game init, game load, disconnect, ...
141 IdSetupGame=1, // sent to a newly connected player
142 IdSetupGameContinue=2, // continue the setup
143 IdGameLoad=3, // load/save the game to the client
144 IdGameConnected=4, // Client successfully connected to master
145 IdSyncRandom=5, // new random seed set - sync games
146 IdDisconnect=6, // KGame object disconnects from game
147 IdGameSetupDone=7, // New game client is now operational
148
149// properties
150 IdPlayerProperty=20, // a player property changed
151 IdGameProperty=21, // a game property changed
152
153// player management
154 IdAddPlayer=30, // add a player
155 IdRemovePlayer=31, // the player will be removed
156 IdActivatePlayer=32, // Activate a player
157 IdInactivatePlayer=33, // Inactivate a player
158 IdTurn=34, // Turn to be prepared
159
160// to-be-categorized
161 IdError=100, // an error occurred
162 IdPlayerInput=101, // a player input occurred
163 IdIOAdded=102, // KGameIO got added to a player...init this IO
164
165// special ids for computer player
166 IdProcessQuery=220, // Process queries data (process only)
167 IdPlayerId=221, // PlayerId got changed (process only)
168
169 IdUser=256 // a user specified message
170 };
171};
172
173#endif

libtdegames

Skip menu "libtdegames"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdegames

Skip menu "libtdegames"
  • libtdegames
Generated for libtdegames by doxygen 1.9.4
This website is maintained by Timothy Pearson.