Changeset 10869
- Timestamp:
- Nov 27, 2015, 8:39:46 AM (9 years ago)
- Location:
- code/branches/campaignHS15/src/orxonox/controllers
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
r10864 r10869 130 130 { 131 131 return this->formationMode_; 132 }133 void CommonController::setRank(Rank::Value val)134 {135 this->rank_ = val;136 }137 Rank::Value CommonController::getRank() const138 {139 return this->rank_;140 132 } 141 133 -
code/branches/campaignHS15/src/orxonox/controllers/CommonController.h
r10864 r10869 53 53 }; 54 54 } 55 namespace Rank56 {57 enum Value58 {59 NONE, SECTIONLEADER, DIVISIONLEADER, WINGMAN60 };61 55 62 }63 64 56 65 57 … … 86 78 FormationMode::Value getFormationMode() const; 87 79 88 void setRank(Rank::Value val); 89 Rank::Value getRank() const; 90 80 91 81 92 82 //----[/XML methods]---- … … 172 162 //----["Private" variables]---- 173 163 FormationMode::Value formationMode_; 174 Rank::Value rank_;175 164 176 165 int attackRange_; -
code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
r10864 r10869 45 45 this->myWingman_ = 0; 46 46 this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&DivisionController::action, this))); 47 this->rank_ = Rank::DIVISIONLEADER;48 47 } 49 48 … … 107 106 108 107 } 108 //I wanted to do it different here, but at this point I think nothing will change if I delete that method 109 109 void DivisionController::stayNearProtect() 110 110 { … … 112 112 } 113 113 114 bool DivisionController::setWingman( ActionpointController* cwingman)114 bool DivisionController::setWingman(CommonController* cwingman) 115 115 { 116 116 -
code/branches/campaignHS15/src/orxonox/controllers/DivisionController.h
r10864 r10869 53 53 //----[own functions]---- 54 54 virtual bool setFollower(LeaderController* myFollower); 55 virtual bool setWingman( ActionpointController* cwingman);55 virtual bool setWingman(CommonController* cwingman); 56 56 virtual bool hasWingman(); 57 57 virtual bool hasFollower(); -
code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
r10866 r10869 47 47 this->myWingman_ = 0; 48 48 this->myDivisionLeader_ = 0; 49 this->rank_ = Rank::SECTIONLEADER;50 49 this->bFirstAction_ = true; 51 50 //orxout(internal_error) << this << "Was created" << endl; … … 285 284 { 286 285 //0ptr or not DivisionController? 287 if (!(it) || !((it)->get Rank() == Rank::DIVISIONLEADER) || !(it->getControllableEntity()))286 if (!(it) || !((it)->getIdentifier()->getName() == "DivisionController") || !(it->getControllableEntity())) 288 287 continue; 289 288 //same team? … … 311 310 return 0; 312 311 } 313 bool SectionController::setWingman( ActionpointController* cwingman)312 bool SectionController::setWingman(CommonController* cwingman) 314 313 { 315 314 WeakPtr<WingmanController> wingman = orxonox_cast<WingmanController*>(cwingman); -
code/branches/campaignHS15/src/orxonox/controllers/SectionController.h
r10864 r10869 53 53 LeaderController* findNewDivisionLeader(); 54 54 55 virtual bool setWingman( ActionpointController* cwingman);55 virtual bool setWingman(CommonController* cwingman); 56 56 virtual bool hasWingman(); 57 57 -
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 } -
code/branches/campaignHS15/src/orxonox/controllers/WingmanController.h
r10864 r10869 52 52 53 53 //----[own functions]---- 54 ActionpointController* findNewLeader();54 CommonController* findNewLeader(); 55 55 //----[/own functions]---- 56 56
Note: See TracChangeset
for help on using the changeset viewer.