- Timestamp:
- Nov 27, 2015, 8:39:46 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc
r10864 r10869 41 41 this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&WingmanController::action, this))); 42 42 this->myLeader_ = 0; 43 this->rank_ = Rank::WINGMAN;44 43 this->bFirstAction_ = true; 45 44 … … 81 80 if (!this->myLeader_) 82 81 { 83 ActionpointController* newLeader = findNewLeader();82 ActionpointController* newLeader = orxonox_cast<ActionpointController*> (findNewLeader()); 84 83 this->myLeader_ = newLeader; 85 84 … … 172 171 Vector3* targetRelativePosition; 173 172 174 if (this->myLeader_->get Rank() == Rank::DIVISIONLEADER)173 if (this->myLeader_->getIdentifier()->getName() == "DivisionController") 175 174 { 176 175 switch (this->formationMode_){ … … 217 216 } 218 217 //----POST: closest leader that is ready to take a new wingman is returned---- 219 ActionpointController* WingmanController::findNewLeader()218 CommonController* WingmanController::findNewLeader() 220 219 { 221 220 … … 224 223 225 224 //----vars for finding the closest leader---- 226 ActionpointController* closestLeader = 0;225 CommonController* closestLeader = 0; 227 226 float minDistance = std::numeric_limits<float>::infinity(); 228 227 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) 230 229 { 231 230 //----0ptr or not a leader or dead?---- 232 231 if (!it || 233 (it->get Rank() != Rank::SECTIONLEADER && it->getRank() != Rank::DIVISIONLEADER) ||232 (it->getIdentifier()->getName() != "SectionController" && it->getIdentifier()->getName() != "DivisionController") || 234 233 !(it->getControllableEntity())) 235 234 continue; … … 251 250 { 252 251 //----Racing conditions---- 253 if (closestLeader->setWingman( this))252 if (closestLeader->setWingman(orxonox_cast<CommonController*>(this))) 254 253 return closestLeader; 255 254 }
Note: See TracChangeset
for help on using the changeset viewer.