Made m_player private in Controller.

This commit is contained in:
hiker 2016-01-11 17:35:24 +11:00
parent 4d28bb484f
commit 6816b08af1
4 changed files with 9 additions and 8 deletions

View File

@ -32,6 +32,8 @@ Controller::Controller(AbstractKart *kart, StateManager::ActivePlayer *player)
m_controls = &(kart->getControls());
m_kart = kart;
m_player = player;
if(player)
player->setKart(kart);
setControllerName("Controller");
} // Controller

View File

@ -41,6 +41,11 @@ class Material;
*/
class Controller
{
private:
/** If this belongs to a player, it stores the active player data
* structure. Otherwise it is 0. */
StateManager::ActivePlayer *m_player;
protected:
/** Pointer to the kart that is controlled by this controller. */
AbstractKart *m_kart;
@ -49,10 +54,6 @@ protected:
* it commands. */
KartControl *m_controls;
/** If this belongs to a player, it stores the active player data
* structure. Otherwise it is 0. */
StateManager::ActivePlayer *m_player;
/** The name of the controller, mainly used for debugging purposes. */
std::string m_controller_name;

View File

@ -90,7 +90,7 @@ public:
/** Returns if the original controller of the kart was a player
* controller. This way e.g. highscores can still be assigned
* to the right player. */
virtual bool isPlayerController () const {return m_player!=NULL;}
virtual bool isPlayerController () const {return getPlayer()!=NULL;}
virtual void action (PlayerAction action, int value);
virtual void newLap (int lap);

View File

@ -40,11 +40,9 @@
PlayerController::PlayerController(AbstractKart *kart,
StateManager::ActivePlayer *player)
: Controller(kart)
: Controller(kart, player)
{
assert(player != NULL);
m_player = player;
m_player->setKart(kart);
m_penalty_time = 0.0f;
} // PlayerController