Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 30, 2013, 4:04:26 PM (12 years ago)
Author:
maxima
Message:

setNewMasterWithInFormation works!

Location:
code/branches/formationupdate/src/orxonox/controllers
Files:
2 edited

Legend:

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

    r9619 r9620  
    534534    }
    535535
    536     /*
     536
    537537    void FormationController::setNewMasterWithinFormation(FormationController* newMaster)
    538538        {
    539             if(this->state_ != MASTER) return;
     539            if(this->state_ != MASTER || newMaster->myMaster_ != this) return;
    540540
    541541            if (!this->slaves_.empty())
    542542            {
     543                                std::vector<FormationController*>::iterator it2 = std::find(this->slaves_.begin(), this->slaves_.end(), newMaster);
     544                                if (it2 != this->slaves_.end())
     545                                {
     546                                         this->slaves_.erase(it2);
     547                                }
     548
    543549                newMaster->state_ = MASTER;
    544550                newMaster->slaves_ = this->slaves_;
     
    555561            this->state_ = FREE;
    556562        }
    557      */
     563
    558564
    559565
  • code/branches/formationupdate/src/orxonox/controllers/FormationController.h

    r9619 r9620  
    6060      static void formationsize(const int size);
    6161      void setNewMasterWithinFormation();
    62       //void setNewMasterWithinFormation(FormationController* newMaster);
     62      void setNewMasterWithinFormation(FormationController* newMaster);
    6363
    6464      inline void setFormationFlight(bool formation)
Note: See TracChangeset for help on using the changeset viewer.