Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9619


Ignore:
Timestamp:
Apr 30, 2013, 3:55:12 PM (11 years ago)
Author:
maxima
Message:

New function SetNewMasterWithinFormation(FormationController), but it does not work yet.

Location:
code/branches/formationupdate/src/orxonox
Files:
3 edited

Legend:

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

    r9348 r9619  
    534534    }
    535535
     536    /*
     537    void FormationController::setNewMasterWithinFormation(FormationController* newMaster)
     538        {
     539            if(this->state_ != MASTER) return;
     540
     541            if (!this->slaves_.empty())
     542            {
     543                newMaster->state_ = MASTER;
     544                newMaster->slaves_ = this->slaves_;
     545                newMaster->myMaster_ = 0;
     546
     547                for(std::vector<FormationController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++)
     548                {
     549                    (*it)->myMaster_ = newMaster;
     550                }
     551            }
     552
     553            this->slaves_.clear();
     554            this->specificMasterAction_ = NONE;
     555            this->state_ = FREE;
     556        }
     557     */
     558
    536559
    537560  /**
  • code/branches/formationupdate/src/orxonox/controllers/FormationController.h

    r9617 r9619  
    5959      static void passivebehaviour(const bool passive);
    6060      static void formationsize(const int size);
    61       void takeLeadOfFormation();
    62       void loseMasterState();
     61      void setNewMasterWithinFormation();
     62      //void setNewMasterWithinFormation(FormationController* newMaster);
    6363
    6464      inline void setFormationFlight(bool formation)
     
    103103      FormationController* getMaster( void ) { return myMaster_; }
    104104      FormationController* getThis( void ) { return this; }
     105      FormationController* getSlave( void ) { return this->slaves_.back(); }
    105106
    106107  protected:
     
    133134      void searchNewMaster();
    134135      void commandSlaves();
    135       void setNewMasterWithinFormation();
     136      void takeLeadOfFormation();
     137      void loseMasterState();
    136138
    137139      void freeSlaves();
  • code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc

    r9617 r9619  
    365365
    366366                        // set new Master
    367                                         orxonox_cast<FormationController*>(this->getController())->loseMasterState();
    368 
    369 
    370 
    371                         /* TO DO: - new Master is not set right
    372                          *                - The slave still has a AIController
     367                                        //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
    373373                         *
    374374                         */
     
    377377                                this->getPlayer()->startControl(entity);
    378378
    379                                         //orxonox_cast<FormationController*>(this->getController())->takeLeadOfFormation();
    380379
    381380                }
Note: See TracChangeset for help on using the changeset viewer.