Changeset 9625 for code/trunk/src/orxonox/controllers
- Timestamp:
- May 21, 2013, 3:12:21 PM (12 years ago)
- Location:
- code/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/formationupdate (added) merged: 9580-9584,9613-9624
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/controllers/Controller.h
r8706 r9625 65 65 virtual void changedControllableEntity() {} 66 66 67 protected:68 67 // don't use this directly, use getPlayer()->startControl(entity) (unless you know exactly what you do) 69 68 inline void setControllableEntity(ControllableEntity* entity) -
code/trunk/src/orxonox/controllers/FormationController.cc
r9348 r9625 535 535 536 536 537 // Sets newMaster as the new master within the formation. Called by the master. 538 void FormationController::setNewMasterWithinFormation(FormationController* newMaster) 539 { 540 if(this->state_ != MASTER || newMaster->myMaster_ != this) return; 541 542 if (!this->slaves_.empty()) 543 { 544 std::vector<FormationController*>::iterator it2 = std::find(this->slaves_.begin(), this->slaves_.end(), newMaster); 545 if (it2 != this->slaves_.end()) 546 { 547 this->slaves_.erase(it2); 548 } 549 550 newMaster->state_ = MASTER; 551 newMaster->slaves_ = this->slaves_; 552 newMaster->myMaster_ = 0; 553 554 for(std::vector<FormationController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++) 555 { 556 (*it)->myMaster_ = newMaster; 557 } 558 } 559 560 this->slaves_.clear(); 561 this->specificMasterAction_ = NONE; 562 this->state_ = FREE; 563 } 564 565 566 537 567 /** 538 @brief Frees all slaves f orm a master. Initiated by a master.568 @brief Frees all slaves from a master. Initiated by a master. 539 569 */ 540 570 void FormationController::freeSlaves() -
code/trunk/src/orxonox/controllers/FormationController.h
r9348 r9625 59 59 static void passivebehaviour(const bool passive); 60 60 static void formationsize(const int size); 61 void setNewMasterWithinFormation(FormationController* newMaster); 61 62 62 63 inline void setFormationFlight(bool formation) … … 98 99 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage); 99 100 101 FormationController* getMaster( void ) { return myMaster_; } 102 FormationController* getController( void ) { return this; } 103 FormationController* getSlave( void ) { return this->slaves_.back(); } 104 100 105 protected: 101 106 bool formationFlight_; … … 127 132 void searchNewMaster(); 128 133 void commandSlaves(); 134 void takeLeadOfFormation(); 135 void loseMasterState(); 129 136 void setNewMasterWithinFormation(); 130 137 131 138 void freeSlaves(); 132 139 void forceFreeSlaves(); 133 void loseMasterState();134 140 void forceFreedom(); 135 141 bool forcedFree(); 136 142 137 void takeLeadOfFormation();138 143 void masterAttacked(Pawn* originator); 139 144 … … 159 164 160 165 void setTarget(Pawn* target); 166 161 167 void searchNewTarget(); 162 168 void forgetTarget(); -
code/trunk/src/orxonox/controllers/HumanController.cc
r9256 r9625 102 102 103 103 // commandslaves when Master of a formation 104 if (HumanController::localController_s && HumanController::localController_s->state_==MASTER )104 if (HumanController::localController_s && HumanController::localController_s->state_==MASTER && FormationController::slaves_.size() > 0) 105 105 { 106 106 if (HumanController::localController_s->formationMode_ != ATTACK)
Note: See TracChangeset
for help on using the changeset viewer.