summaryrefslogtreecommitdiffstats
path: root/KeyboardController.cpp
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 /KeyboardController.cpp
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 'KeyboardController.cpp')
-rw-r--r--KeyboardController.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/KeyboardController.cpp b/KeyboardController.cpp
index 1e4f89c..a6f0ec3 100644
--- a/KeyboardController.cpp
+++ b/KeyboardController.cpp
@@ -2,8 +2,8 @@
#include <iostream>
-KeyboardController::KeyboardController(Player& player, uint leftKey, uint rightKey):
- Controller(player),
+KeyboardController::KeyboardController(Player* pPlayer, uint leftKey, uint rightKey):
+ Controller(pPlayer),
m_leftKey(leftKey),
m_rightKey(rightKey)
{
@@ -29,11 +29,11 @@ void KeyboardController::think()
{
if (m_nextMove == MOVE_LEFT)
{
- m_player.turnLeft();
+ m_pPlayer->turnLeft();
}
else if (m_nextMove == MOVE_RIGHT)
{
- m_player.turnRight();
+ m_pPlayer->turnRight();
}
m_nextMove = NO_MOVE;
}