summaryrefslogtreecommitdiffstats
path: root/Game.h
diff options
context:
space:
mode:
authormario <mario@notk.org>2011-11-30 01:42:45 +0100
committermario <mario@notk.org>2011-11-30 01:42:45 +0100
commit09bca1fdee6ead5d0a4d34bca3ec979ad82d0496 (patch)
tree3f209bdc5dbf271014c7a932c4955de65790e94d /Game.h
parent67dec7c3daaee2e86c512d0984e9ab23b376892b (diff)
Changed all Player& to Player*
Changed game's vector<Player> to a Vector<Player*> with associated dynamic allocation & deallocation. Changed Game's API for creating player (now 1 by 1). Changed the way of adding a KeyboardController (now the MainWindow creates and adds the controller). Added missing initializations to Player's default constructor
Diffstat (limited to 'Game.h')
-rw-r--r--Game.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/Game.h b/Game.h
index 9abf863..93bc5d8 100644
--- a/Game.h
+++ b/Game.h
@@ -12,31 +12,31 @@ const uint numColors = sizeof(playerColors)/sizeof(PlayerColor);
class Game
{
public:
- Game(int width, int height, PlayerNumber num);
+ Game(int width, int height);
virtual ~Game(void);
- void restart();
public:
+
void pauseGame();
void resumeGame();
void toggleGame();
bool isRunning();
- /**
- * This function is to be called by the MainWindow at each Main loop iteration.
- **/
+ void restart();
+ void start();
void updateGame(uint timeElapsedMs);
-
- Player& getPlayerByID(PlayerNumber id);
-
+ Player* getPlayerByID(PlayerNumber id);
Field& getField();
+ void init(int width, int height, PlayerNumber num);
+ Player* addPlayer();
private:
- void init(int width, int height, PlayerNumber num);
- void init_player(Player& player, PlayerNumber i, PlayerNumber num);
+ void initField(int width, int height);
+ void initPlayer(Player* pPlayer, PlayerNumber playerID);
+ void placePlayers();
static PlayerColor getColor(PlayerNumber n);
void killPlayer(Player *player);
- std::vector<Player> m_vPlayers;
+ std::vector<Player*> m_vpPlayers;
bool m_gameRunning;
Field m_Field;
int m_width;