24 #include <QtCore/QDataStream>
25 #include <QtCore/QString>
26 #include <QtCore/QList>
29 #include "../libkdegamesprivate_export.h"
30 class KRandomSequence;
111 virtual void Debug();
136 KGamePlayerList *playerList();
141 const KGamePlayerList *playerList()
const;
147 KGamePlayerList *inactivePlayerList();
152 const KGamePlayerList *inactivePlayerList()
const;
159 KRandomSequence *random()
const;
171 bool isRunning()
const;
179 KPlayer *findPlayer(quint32
id)
const;
209 bool addPlayer(
KPlayer* newplayer);
226 void playerDeleted(
KPlayer * player);
231 bool activatePlayer(
KPlayer *player);
236 bool inactivatePlayer(
KPlayer *player);
244 void setMaxPlayers(uint maxnumber);
250 int maxPlayers()
const;
258 void setMinPlayers(uint minnumber);
264 uint minPlayers()
const;
270 uint playerCount()
const;
323 virtual KPlayer *createPlayer(
int rtti,
int io,
bool isvirtual);
338 virtual bool load(
QDataStream &stream,
bool reset=
true);
348 virtual bool load(
const QString& filename,
bool reset=
true);
359 virtual bool save(
QDataStream &stream,
bool saveplayers=
true);
369 virtual bool save(
const QString& filename,
bool saveplayers=
true);
378 virtual bool reset();
387 int gameStatus()
const;
394 void setGameStatus(
int status);
404 bool sendPlayerProperty(
int msgid,
QDataStream& s, quint32 playerId);
418 void setPolicy(GamePolicy p,
bool recursive=
true);
423 GamePolicy policy()
const;
436 bool sendGroupMessage(
const QByteArray& msg,
int msgid, quint32 sender,
const QString& group);
437 bool sendGroupMessage(
const QDataStream &msg,
int msgid, quint32 sender,
const QString& group);
438 bool sendGroupMessage(
int msg,
int msgid, quint32 sender,
const QString& group);
439 bool sendGroupMessage(
const QString& msg,
int msgid, quint32 sender,
const QString& group);
470 void sendProperty(
int msgid,
QDataStream& stream,
bool* sent);
481 virtual void prepareNext();
488 void slotClientConnected(quint32 clientId);
497 void slotClientDisconnected(quint32 clientId,
bool broken);
504 void slotServerDisconnected();
524 void signalReplacePlayerIO(
KPlayer* player,
bool*
remove);
586 void signalLoadError(
QDataStream &stream,
bool network,
int cookie,
bool &result);
594 void signalNetworkData(
int msgid,
const QByteArray& buffer, quint32 receiver, quint32 sender);
601 void signalMessageUpdate(
int msgid,quint32 receiver,quint32 sender);
613 void signalPlayerLeftGame(
KPlayer *player);
620 void signalPlayerJoinedGame(
KPlayer *player);
637 void signalGameOver(
int status,
KPlayer *current,
KGame *me);
650 void signalClientJoinedGame(quint32 clientid,
KGame *me);
669 void signalClientLeftGame(
int clientID,
int oldgamestatus,
KGame *me);
753 Q_UNUSED( oldplayer );
754 Q_UNUSED( newplayer );
755 Q_UNUSED( inactivate );
766 void savePlayers(
QDataStream &stream,KGamePlayerList *list=0);
794 bool systemInactivatePlayer(
KPlayer *player);
799 bool systemActivatePlayer(
KPlayer *player);
818 bool systemAddPlayer(
KPlayer* newplayer);
827 void systemRemovePlayer(
KPlayer* player,
bool deleteit);
839 virtual void negotiateNetworkGame(quint32 clientID);
847 void deletePlayers();
848 void deleteInactivePlayers();
857 virtual int checkGameOver(
KPlayer *player);
872 virtual bool loadgame(
QDataStream &stream,
bool network,
bool reset);
883 virtual bool savegame(
QDataStream &stream,
bool network,
bool saveplayers);
903 bool removePlayer(
KPlayer * player, quint32 receiver);
908 void setupGame(quint32 sender);
913 void setupGameContinue(
QDataStream& msg, quint32 sender);
922 bool systemRemove(
KPlayer* player,
bool deleteit);
926 KGamePrivate*
const d;
This class takes care of round or move management as well of the gameover condition.
GameStatus
Game status - Use this to Control the game flow.
bool removePlayer(KPlayer *player)
Sends a message over the network, msgid=IdRemovePlayer.
A collection class for KGameProperty objects.
virtual void newPlayersJoin(KGamePlayerList *oldplayer, KGamePlayerList *newplayer, QList< int > &inactivate)
This virtual function can be overwritten for your own player management.
GamePolicy
The policy of the property.
QList< KPlayer * > KGamePlayerList
Base class for a game player.
Base class of KGameProperty.
virtual void networkTransmission(QDataStream &, int, quint32, quint32, quint32 clientID)=0
Called by ReceiveNetworkTransmission().
The KGameNetwork class is the KGame class with network support.
The main KDE game object.
virtual void Debug()
Gives debug output of the game status.