Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 27, 2015, 8:39:46 AM (8 years ago)
Author:
gania
Message:

fixed a bug and got rid of unnecessary Rank enumeration, used getIdentifire instead

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc

    r10864 r10869  
    4141        this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&WingmanController::action, this)));
    4242        this->myLeader_ = 0;
    43         this->rank_ = Rank::WINGMAN;
    4443        this->bFirstAction_ = true;
    4544
     
    8180        if (!this->myLeader_)
    8281        {
    83             ActionpointController* newLeader = findNewLeader();
     82            ActionpointController* newLeader = orxonox_cast<ActionpointController*> (findNewLeader());
    8483            this->myLeader_ = newLeader;
    8584           
     
    172171        Vector3* targetRelativePosition;
    173172
    174         if (this->myLeader_->getRank() == Rank::DIVISIONLEADER)
     173        if (this->myLeader_->getIdentifier()->getName() == "DivisionController")
    175174        {
    176175            switch (this->formationMode_){
     
    217216    }
    218217    //----POST: closest leader that is ready to take a new wingman is returned----
    219     ActionpointController* WingmanController::findNewLeader()
     218    CommonController* WingmanController::findNewLeader()
    220219    {
    221220
     
    224223
    225224        //----vars for finding the closest leader----
    226         ActionpointController* closestLeader = 0;
     225        CommonController* closestLeader = 0;
    227226        float minDistance =  std::numeric_limits<float>::infinity();
    228227        Gametype* gt = this->getGametype();
    229         for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
     228        for (ObjectList<CommonController>::iterator it = ObjectList<CommonController>::begin(); it; ++it)
    230229        {
    231230            //----0ptr or not a leader or dead?----
    232231            if (!it ||
    233                 (it->getRank() != Rank::SECTIONLEADER && it->getRank() != Rank::DIVISIONLEADER) ||
     232                (it->getIdentifier()->getName() != "SectionController" && it->getIdentifier()->getName() != "DivisionController") ||
    234233                !(it->getControllableEntity()))
    235234                continue;
     
    251250        {
    252251            //----Racing conditions----
    253             if (closestLeader->setWingman(this))
     252            if (closestLeader->setWingman(orxonox_cast<CommonController*>(this)))
    254253                return closestLeader;
    255254        }
Note: See TracChangeset for help on using the changeset viewer.