Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9256 for code/trunk


Ignore:
Timestamp:
May 28, 2012, 9:06:02 AM (12 years ago)
Author:
landauf
Message:

I think this implementation of the hit() function rather belongs to FormationController than to HumanController

Location:
code/trunk/src/orxonox/controllers
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/controllers/FormationController.cc

    r9255 r9256  
    252252    }
    253253
    254   void FormationController::removeFromFormation()
     254    //used, when slaves are in DEFEND mode.
     255    void FormationController::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
     256    {
     257        if (!this->formationFlight_ || this->state_!=MASTER || this->formationMode_!=DEFEND) return;
     258            this->masterAttacked(originator);
     259    }
     260
     261    void FormationController::removeFromFormation()
    255262    {
    256263        if (this->state_ == SLAVE || this->myMaster_) // slaves can also be temporary free, so check if myMaster_ is set
  • code/trunk/src/orxonox/controllers/FormationController.h

    r9255 r9256  
    9696           { return this->formationMode_; }
    9797
    98     protected:
     98      virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
     99
     100  protected:
    99101      bool formationFlight_;
    100102      bool passive_;
  • code/trunk/src/orxonox/controllers/HumanController.cc

    r9016 r9256  
    8585    HumanController::~HumanController()
    8686    {
    87         if (HumanController::localController_s) 
     87        if (HumanController::localController_s)
    8888        {
    8989            HumanController::localController_s->removeFromFormation();
     
    197197            HumanController::localController_s->keepBoosting();
    198198    }
    199    
     199
    200200    /**
    201201    @brief
     
    302302                orxout(message) <<"FormationFlight enabled "<< endl;
    303303            }
    304            
     304
    305305        }
    306306
     
    332332    }
    333333
    334 
    335     //used, when slaves are in DEFEND mode.
    336     void HumanController::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
    337     {
    338         if (!this->formationFlight_ || this->state_!=MASTER || this->formationMode_!=DEFEND) return;
    339             this->masterAttacked(originator);
    340     }
    341 
    342334    void HumanController::addBots(unsigned int amount)
    343335    {
  • code/trunk/src/orxonox/controllers/HumanController.h

    r9016 r9256  
    7474            void keepBoosting(void);
    7575            void terminateBoosting(void);
    76                  
     76
    7777
    7878            static void greet();
     
    8888            static void toggleFormationFlight();
    8989            static void FFChangeMode();
    90             virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
    91 
    9290
    9391            static void addBots(unsigned int amount);
     
    108106            static HumanController* localController_s;
    109107            bool controlPaused_;
    110        
     108
    111109        private:
    112110            bool boosting_; // Whether the HumanController is in boosting mode or not.
Note: See TracChangeset for help on using the changeset viewer.