Changeset 9624
- Timestamp:
- May 14, 2013, 3:42:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
r9622 r9624 309 309 310 310 311 // A function to check if this pawn's controller is the master of any formationcontroller312 bool Pawn::hasSlaves()313 {314 for (ObjectList<FormationController>::iterator it =315 ObjectList<FormationController>::begin();316 it != ObjectList<FormationController>::end(); ++it )317 {318 // checks if the pawn's controller has a slave319 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())320 return true;321 }322 return false;323 }324 325 // A function that returns a slave of the pawn's controller326 Controller* Pawn::getSlave(){327 for (ObjectList<FormationController>::iterator it =328 ObjectList<FormationController>::begin();329 it != ObjectList<FormationController>::end(); ++it )330 {331 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())332 return it->getController();333 }334 return 0;335 }336 337 338 311 void Pawn::death() 339 312 { … … 348 321 if (this->getGametype()) 349 322 this->getGametype()->pawnKilled(this, this->lastHitOriginator_); 350 351 323 352 324 if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this) … … 527 499 } 528 500 501 502 // A function to check if this pawn's controller is the master of any formationcontroller 503 bool Pawn::hasSlaves() 504 { 505 for (ObjectList<FormationController>::iterator it = 506 ObjectList<FormationController>::begin(); 507 it != ObjectList<FormationController>::end(); ++it ) 508 { 509 // checks if the pawn's controller has a slave 510 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController()) 511 return true; 512 } 513 return false; 514 } 515 516 // A function that returns a slave of the pawn's controller 517 Controller* Pawn::getSlave(){ 518 for (ObjectList<FormationController>::iterator it = 519 ObjectList<FormationController>::begin(); 520 it != ObjectList<FormationController>::end(); ++it ) 521 { 522 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController()) 523 return it->getController(); 524 } 525 return 0; 526 } 527 528 529 529 530 }
Note: See TracChangeset
for help on using the changeset viewer.