Changeset 6696 for code/branches/ai/src/orxonox/controllers
- Timestamp:
- Apr 12, 2010, 4:52:01 PM (15 years ago)
- Location:
- code/branches/ai/src/orxonox/controllers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai/src/orxonox/controllers/AIController.cc
r6695 r6696 77 77 if (this->state_ == MASTER)//MASTER 78 78 { 79 79 80 // command slaves 80 81 this->commandSlaves(); 82 83 84 // lose master status (only if less than 4 slaves in formation) 85 random = rnd(maxrand); 86 if(random < 5/(this->slaves.size()+1) && this->slaves.size() < 5 ) 87 this->loseMasterState(); 88 89 // look out for outher masters if formation is small 90 if(this->slaves.size() < 3) 91 this->searchNewMaster(); 81 92 82 93 // search enemy -
code/branches/ai/src/orxonox/controllers/ArtificialController.cc
r6695 r6696 132 132 if (static_cast<ControllableEntity*>(*it) != this->getControllableEntity()) //&& it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) < 1000 133 133 { 134 if(controller->slaves.size() > 9) continue; 135 136 this->freeAllSlaves(); 137 this->slaves.clear(); 134 138 this->state_ = SLAVE; 139 135 140 this->myMaster_ = controller; 136 141 controller->slaves.push_back(this); 142 137 143 break; 138 144 } … … 170 176 { 171 177 178 179 for(std::list<ArtificialController*>::iterator it = slaves.begin(); it != slaves.end(); it++) 180 { 181 (*it)->state_ = FREE; 182 } 183 /* 172 184 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it) 173 185 { … … 178 190 controller->state_ = FREE; 179 191 } 180 181 } 182 192 */ 193 } 194 195 void ArtificialController::loseMasterState() 196 { 197 this->freeAllSlaves(); 198 this->state_ = FREE; 199 } 183 200 184 201 void ArtificialController::setTargetPosition(const Vector3& target) -
code/branches/ai/src/orxonox/controllers/ArtificialController.h
r6695 r6696 66 66 void commandSlaves(); 67 67 void freeAllSlaves(); 68 void loseMasterState(); 68 69 69 70 ArtificialController *myMaster_;
Note: See TracChangeset
for help on using the changeset viewer.