26 #include <tqptrlist.h> 28 #include "kgameproperty.h" 29 #include <tdemacros.h> 69 class TDE_EXPORT
KPlayer :
public TQObject
75 typedef TQPtrList<KGameIO> KGameIOList;
99 virtual int rtti()
const {
return 0;}
112 KGameIOList *
ioList() {
return &mInputList;}
156 bool isVirtual()
const;
165 void setVirtual(
bool v);
188 TQ_UINT32 id()
const;
195 void setId(TQ_UINT32 i);
208 int userId()
const {
return mUserId.value();}
214 void setUserId(
int i) {mUserId = i;}
226 int networkPriority()
const;
244 void setNetworkPriority(
int b);
251 KPlayer *networkPlayer()
const;
256 void setNetworkPlayer(
KPlayer *p);
263 void setGroup(
const TQString& group);
268 virtual const TQString& group()
const;
275 void setName(
const TQString& name);
280 virtual const TQString& name()
const;
292 bool addGameIO(
KGameIO *input);
304 bool removeGameIO(
KGameIO *input=0,
bool deleteit=
true);
313 KGameIO *findRttiIO(
int rtti)
const;
322 bool hasRtti(
int rtti)
const {
return findRttiIO(rtti)!=0;}
337 virtual bool forwardInput(TQDataStream &msg,
bool transmit=
true, TQ_UINT32 sender=0);
342 virtual bool forwardMessage(TQDataStream &msg,
int msgid,TQ_UINT32 receiver=0,TQ_UINT32 sender=0);
350 bool myTurn()
const {
return mMyTurn.value();}
361 bool setTurn(
bool b,
bool exclusive=
true);
376 virtual bool load(TQDataStream &stream);
385 virtual bool save(TQDataStream &stream);
394 void networkTransmission(TQDataStream &stream,
int msgid,TQ_UINT32 sender);
434 void signalNetworkData(
int msgid,
const TQByteArray& buffer, TQ_UINT32 sender,
KPlayer *me);
448 void sendProperty(
int msgid, TQDataStream& stream,
bool* sent);
461 KGameIOList mInputList;
KGame * game() const
Query to which game the player belongs to.
virtual int rtti() const
The idendification of the player.
A collection class for KGameProperty objects.
KGameIOList * ioList()
Returns a list of input devices.
bool hasRtti(int rtti) const
Checks whether this player has a IO device of the given rtti type.
void setActive(bool v)
Set an player as active (true) or inactive (false)
bool asyncInput() const
Query whether this player does asynchronous input.
Base class for a game player.
int userId() const
Returns the user defined id of the player This value can be used arbitrary by you to have some user i...
Base class of KGameProperty.
bool isActive() const
Is this player an active player.
void setGame(KGame *game)
sets the game the player belongs to.
The main KDE game object.
void setAsyncInput(bool a)
Set whether this player can make turns/input all the time (true) or only when it is its turn (false) ...
Base class for IO devices for games.
bool myTurn() const
is it my turn to go