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

libtdegames

  • libtdegames
  • kgame
kgameprocess.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 __KGAMEPROCESS_H_
24 #define __KGAMEPROCESS_H_
25 
26 #include <tqstring.h>
27 #include <tqobject.h>
28 #include <tqfile.h>
29 
30 #include "kgameproperty.h"
31 #include <krandomsequence.h>
32 #include <tdemacros.h>
33 class KPlayer;
34 class KMessageFilePipe;
35 
42 class TDE_EXPORT KGameProcess: public TQObject
43 {
44  TQ_OBJECT
45 
46 
47  public:
74  KGameProcess();
78  ~KGameProcess();
79 
84  bool exec(int argc, char *argv[]);
85 
92  bool terminate() const {return mTerminate;}
93 
100  void setTerminate(bool b) {mTerminate=b;}
101 
111  void sendMessage(TQDataStream &stream,int msgid,TQ_UINT32 receiver=0);
112 
132  void sendSystemMessage(TQDataStream &stream,int msgid,TQ_UINT32 receiver=0);
133 
143  KRandomSequence *random() {return mRandom;}
144 
145  protected:
150  void processArgs(int argc, char *argv[]);
151 
152  protected slots:
157  void receivedMessage(const TQByteArray& receiveBuffer);
158 
159  signals:
181  void signalCommand(TQDataStream &inputStream,int msgid,int receiver,int sender);
182 
220  void signalTurn(TQDataStream &stream,bool turn);
221 
233  void signalInit(TQDataStream &stream,int userid);
234 
235  protected:
236  bool mTerminate;
237  KMessageFilePipe *mMessageIO;
238  private:
239  TQFile rFile;
240  TQFile wFile;
241  KRandomSequence* mRandom;
242 };
243 #endif
KGameProcess
This is the process class used on the computer player side to communicate with its counterpart TDEPro...
Definition: kgameprocess.h:43
KGameProcess::signalInit
void signalInit(TQDataStream &stream, int userid)
This signal is emmited when the process is initialized, i.e.
KGameProcess::signalCommand
void signalCommand(TQDataStream &inputStream, int msgid, int receiver, int sender)
The generic communication signal.
KGameProcess::terminate
bool terminate() const
Should the computer process leave its exec function? Activated if you setTerminate(true);.
Definition: kgameprocess.h:92
KGameProcess::random
KRandomSequence * random()
Returns a pointer to a KRandomSequence.
Definition: kgameprocess.h:143
KGameProcess::setTerminate
void setTerminate(bool b)
Set this to true if the computer process should end, ie leave its exec function.
Definition: kgameprocess.h:100
KGameProcess::signalTurn
void signalTurn(TQDataStream &stream, bool turn)
This signal is emmited if the computer player should perform a turn.
KPlayer
Base class for a game player.
Definition: kplayer.h:70

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.1
This website is maintained by Timothy Pearson.