Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 7, 2013, 3:58:33 PM (12 years ago)
Author:
maxima
Message:
 
Location:
code/branches/formationupdate/src/orxonox
Files:
3 edited

Legend:

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

    r9620 r9621  
    535535
    536536
     537    // Sets newMaster as the new master within the formation. Called by the master.
    537538    void FormationController::setNewMasterWithinFormation(FormationController* newMaster)
    538539        {
     
    565566
    566567  /**
    567         @brief Frees all slaves form a master. Initiated by a master.
     568        @brief Frees all slaves from a master. Initiated by a master.
    568569    */
    569570    void FormationController::freeSlaves()
  • code/branches/formationupdate/src/orxonox/controllers/FormationController.h

    r9620 r9621  
    5959      static void passivebehaviour(const bool passive);
    6060      static void formationsize(const int size);
    61       void setNewMasterWithinFormation();
    6261      void setNewMasterWithinFormation(FormationController* newMaster);
    6362
     
    10099      virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
    101100
    102       /* Just for testing purposes: report the master. */
    103101      FormationController* getMaster( void ) { return myMaster_; }
    104       FormationController* getThis( void ) { return this; }
     102      FormationController* getController( void ) { return this; }
    105103      FormationController* getSlave( void ) { return this->slaves_.back(); }
    106104
     
    136134      void takeLeadOfFormation();
    137135      void loseMasterState();
     136      void setNewMasterWithinFormation();
    138137
    139138      void freeSlaves();
  • code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc

    r9620 r9621  
    309309
    310310
    311     /* Two functions to find the slaves of a Pawn
    312      *
    313      */
     311    // A function to check if this pawn's controller is the master of any formationcontroller
    314312    bool Pawn::hasSlaves()
    315313    {
     
    318316                         it != ObjectList<FormationController>::end(); ++it )
    319317                {
    320                         // checks if the Pawn has a slave
     318                        // checks if the pawn's controller has a slave
    321319                        if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
    322320                                return true;
     
    325323    }
    326324
     325    // A function that returns a slave of the pawn's controller
    327326    Controller* Pawn::getSlave(){
    328327        for (ObjectList<FormationController>::iterator it =
     
    331330        {
    332331                if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
    333                         return it->getThis();
     332                        return it->getController();
    334333        }
    335334        return 0;
     
    353352            if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
    354353            {
    355 
    356                 // Do different things if Pawn is the Master of a Formation
     354                // Start to control a new entity if you're the master of a formation
    357355                if(this->hasSlaves())
    358356                {
     
    363361                        slave->setControllableEntity(0);
    364362
    365 
    366                         // set new Master
     363                        // set a new master within the formation
    367364                                        orxonox_cast<FormationController*>(this->getController())->setNewMasterWithinFormation(orxonox_cast<FormationController*>(slave));
    368                         //orxonox_cast<FormationController*>(this->getController())->setNewMasterWithinFormation();
    369 
    370 
    371                         /* TO DO: - setNewMasterWithinFormation() with an argument.
    372                          *                - set slave as the new master within the formation
    373                          *
    374                          */
    375365
    376366                                        // start to control a slave
    377367                                this->getPlayer()->startControl(entity);
    378 
    379 
    380368                }
    381369                else
Note: See TracChangeset for help on using the changeset viewer.