Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2009, 5:42:50 PM (16 years ago)
Author:
landauf
Message:

Cleaned up setPlayer/removePlayer interface between PlayerInfo and ControllableEntity. The whole control is now up to the PlayerInfo, the respective functions in ControllableEntity are now protected.

Location:
code/trunk/src/orxonox/objects/worldentities
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc

    r2973 r3038  
    9191
    9292            if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
    93                 this->getPlayer()->stopControl(this, false);
     93                this->getPlayer()->stopControl();
    9494
    9595            if (this->hud_)
  • code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h

    r2973 r3038  
    3939    class _OrxonoxExport ControllableEntity : public MobileEntity
    4040    {
     41        friend class PlayerInfo; // PlayerInfo uses setPlayer and removePlayer
     42
    4143        public:
    4244            ControllableEntity(BaseObject* creator);
     
    5052            virtual void changedPlayer() {}
    5153
    52             virtual void setPlayer(PlayerInfo* player);
    53             virtual void removePlayer();
    5454            inline PlayerInfo* getPlayer() const
    5555                { return this->player_; }
     
    131131
    132132        protected:
     133            virtual void setPlayer(PlayerInfo* player); // don't call this directly, use friend class PlayerInfo instead
     134            virtual void removePlayer();                // don't call this directly, use friend class PlayerInfo instead
     135
    133136            virtual void startLocalHumanControl();
    134137            virtual void stopLocalHumanControl();
  • code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r3033 r3038  
    209209                this->getGametype()->pawnKilled(this, this->lastHitOriginator_);
    210210
    211             if (this->getPlayer())
    212                 this->getPlayer()->stopControl(this);
     211            if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
     212                this->getPlayer()->stopControl();
    213213
    214214            if (GameMode::isMaster())
  • code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h

    r2826 r3038  
    4747            virtual void tick(float dt);
    4848            void registerVariables();
    49 
    50             virtual void setPlayer(PlayerInfo* player);
    51             virtual void removePlayer();
    5249
    5350            inline bool isAlive() const
     
    113110
    114111        protected:
     112            virtual void setPlayer(PlayerInfo* player);
     113            virtual void removePlayer();
     114
    115115            virtual void death();
    116116            virtual void deatheffect();
  • code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.h

    r2662 r3038  
    4646            virtual void tick(float dt);
    4747
    48             virtual void setPlayer(PlayerInfo* player);
    49             virtual void startLocalHumanControl();
    50 
    5148            virtual void moveFrontBack(const Vector2& value);
    5249            virtual void moveRightLeft(const Vector2& value);
     
    5956            virtual void fire(WeaponMode::Enum fireMode);
    6057            virtual void greet();
     58
     59        protected:
     60            virtual void setPlayer(PlayerInfo* player);
     61            virtual void startLocalHumanControl();
    6162
    6263        private:
Note: See TracChangeset for help on using the changeset viewer.