summaryrefslogtreecommitdiffstats
path: root/konquest/gameboard.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitc90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch)
tree6d8391395bce9eaea4ad78958617edb20c6a7573 /konquest/gameboard.h
downloadtdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz
tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konquest/gameboard.h')
-rw-r--r--konquest/gameboard.h119
1 files changed, 119 insertions, 0 deletions
diff --git a/konquest/gameboard.h b/konquest/gameboard.h
new file mode 100644
index 00000000..5e3cddfa
--- /dev/null
+++ b/konquest/gameboard.h
@@ -0,0 +1,119 @@
+#ifndef _GAMEBOARD_H_
+#define _GAMEBOARD_H_
+
+#include <qwidget.h>
+
+#include "planet_info.h"
+#include "map_widget.h"
+
+//************************************************************************
+// forward declarations
+//************************************************************************
+class QSlider;
+class QLabel;
+class QListBox;
+class QPushButton;
+class QLineEdit;
+class QTextEdit;
+
+enum GameState { NONE, SOURCE_PLANET, DEST_PLANET, SHIP_COUNT, RULER_SOURCE, RULER_DEST, AI_PLAYER };
+
+//************************************************************************
+// GameBoard Widget
+//************************************************************************
+class GameBoard : public QWidget
+{
+ Q_OBJECT
+
+public:
+ GameBoard( QWidget *parent );
+ virtual ~GameBoard();
+
+ bool isGameInProgress(void) const { return gameInProgress; }
+
+// virtual QSize sizeHint() const;
+
+protected slots:
+ void startNewGame();
+ void shutdownGame();
+ void planetSelected( Planet * );
+ void newShipCount();
+ void nextPlayer();
+
+ //***************************************************************
+ // Toolbar items
+ //***************************************************************
+ void measureDistance();
+ void showScores();
+ void showFleets();
+
+signals:
+ void newGameState( GameState newState );
+
+ //***************************************************************
+ // Event Handlers
+ //***************************************************************
+protected:
+ virtual void keyPressEvent( QKeyEvent * );
+
+private:
+ void turn();
+ void nextTurn();
+ void gameOver();
+
+ void resolveShipsInFlight();
+ void sendAttackFleet( Planet *source, Planet *dest, int ships );
+ void doFleetArrival( AttackFleet *arrivingFleet );
+ void scanForSurvivors();
+
+ void gameMsg(const QString &msg, Player *player = 0, Planet *planet = 0, Player *planetPlayer = 0);
+
+ void changeGameBoard( bool inPlay );
+ void cleanupGame();
+ Player *findWinner();
+
+ QString playerString(Player *player = 0);
+
+ //***************************************************************
+ // Game State information
+ //***************************************************************
+ bool gameInProgress;
+ GameState gameState;
+ PlayerListIterator *currentPlayer;
+
+ //***************************************************************
+ // Display Widgets
+ //***************************************************************
+ ConquestMap *mapWidget;
+ PlanetInfo *planetInfo;
+ QLabel *gameMessage;
+ QLabel *turnCounter;
+ QPushButton *endTurn;
+ QLineEdit *shipCountEdit;
+ QLabel *splashScreen;
+ QTextEdit *msgWidget;
+
+
+ //***************************************************************
+ // Game objects
+ //***************************************************************
+ int turnNumber;
+ int lastTurn;
+
+ PlayerList players;
+ PlanetList planets;
+ Player *neutralPlayer;
+ Map *map;
+
+ bool haveSourcePlanet;
+ Planet *sourcePlanet;
+
+ bool haveDestPlanet;
+ Planet *destPlanet;
+
+ bool haveShipCount;
+ int shipCount;
+
+};
+
+#endif