summaryrefslogtreecommitdiffstats
path: root/libtdegames/kgame/kgamesequence.h
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2011-11-06 15:56:37 -0600
committerTimothy Pearson <[email protected]>2011-11-06 15:56:37 -0600
commit14c49c4f56792a934bcdc4efceebbd429d858571 (patch)
tree2f302410d5a5d678bf3ff10edead70d348be6644 /libtdegames/kgame/kgamesequence.h
parentab0981b9689e4d3ad88e9572bfa4b4a5e36c51ae (diff)
downloadtdegames-14c49c4f56792a934bcdc4efceebbd429d858571.tar.gz
tdegames-14c49c4f56792a934bcdc4efceebbd429d858571.zip
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'libtdegames/kgame/kgamesequence.h')
-rw-r--r--libtdegames/kgame/kgamesequence.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/libtdegames/kgame/kgamesequence.h b/libtdegames/kgame/kgamesequence.h
new file mode 100644
index 00000000..8047c642
--- /dev/null
+++ b/libtdegames/kgame/kgamesequence.h
@@ -0,0 +1,88 @@
+/*
+ This file is part of the KDE games library
+ Copyright (C) 2003 Andreas Beckermann ([email protected])
+ Copyright (C) 2003 Martin Heni ([email protected])
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+/*
+ $Id$
+*/
+#ifndef __KGAMESEQUENCE_H_
+#define __KGAMESEQUENCE_H_
+
+#include <tqobject.h>
+
+class KPlayer;
+class KGame;
+
+/**
+ * This class takes care of round or move management as well of the gameover
+ * condition. It is especially used for round based games. For these games @ref
+ * nextPlayer and @ref checkGameOver are the most important methods.
+ *
+ * You can subclass KGameSequence and use @ref KGame::setGameSequence to use
+ * your own rules. Note that @ref KGame will take ownership and therefore will
+ * delete the object on destruction.
+ * @short Round/move management class
+ * @author Andreas Beckermann <[email protected]>
+ **/
+class KGameSequence : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+public:
+ KGameSequence();
+ virtual ~KGameSequence();
+
+ /**
+ * Select the next player in a turn based game. In an asynchronous game this
+ * function has no meaning. Overwrite this function for your own game sequence.
+ * Per default it selects the next player in the playerList
+ */
+ virtual KPlayer* nextPlayer(KPlayer *last, bool exclusive = true);
+
+ virtual void setCurrentPlayer(KPlayer* p);
+
+ /**
+ * @return The @ref KGame object this sequence is for, or NULL if none.
+ **/
+ KGame* game() const { return mGame; }
+
+ KPlayer* currentPlayer() const { return mCurrentPlayer; }
+
+ /**
+ * Set the @ref KGame object for this sequence. This is called
+ * automatically by @ref KGame::setGameSequence and you should not call
+ * it.
+ **/
+ void setGame(KGame* game);
+
+ /**
+ * Check whether the game is over. The default implementation always
+ * returns 0.
+ *
+ * @param player the player who made the last move
+ * @return anything else but 0 is considered as game over
+ **/
+ virtual int checkGameOver(KPlayer *player);
+
+private:
+ KGame* mGame;
+ KPlayer* mCurrentPlayer;
+};
+
+#endif
+