Changeset 9613 for code/branches/formationupdate/src/orxonox
- Timestamp:
- Apr 9, 2013, 3:49:06 PM (12 years ago)
- Location:
- code/branches/formationupdate/src/orxonox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/formationupdate/src/orxonox/controllers/FormationController.h
r9583 r9613 100 100 /* Just for testing purposes: report the master. */ 101 101 FormationController* getMaster( void ) { return myMaster_; } 102 FormationController* getThis( void ) { return this; } 102 103 103 104 protected: -
code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
r9584 r9613 308 308 } 309 309 310 // Two functions to find the slaves of a Pawn 311 bool Pawn::hasSlaves() 312 { 313 /* TEST TEST This is used to find out if the current pawn is also 314 * the master of the formation and to find his slaves. 315 * 316 */ 317 for (ObjectList<FormationController>::iterator it = 318 ObjectList<FormationController>::begin(); 319 it != ObjectList<FormationController>::end(); ++it ) 320 { 321 // checks if the dying Pawn has a slave 322 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController()) 323 { 324 orxout(user_warning) << "This is a Slave of the HumanController: " << it->getThis() << endl; 325 return true; 326 } 327 } 328 return false; 329 /* TEST TEST */ 330 } 331 332 Controller* Pawn::getSlave(){ 333 for (ObjectList<FormationController>::iterator it = 334 ObjectList<FormationController>::begin(); 335 it != ObjectList<FormationController>::end(); ++it ) 336 { 337 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController()) 338 return it->getThis(); 339 } 340 return 0; 341 } 342 343 310 344 void Pawn::death() 311 345 { 312 /* TEST TEST This is used to find out if the current pawn is also313 * the master of the formation.314 *315 * NOTE: This does not yet check if the current pawn is actually316 * the humanplayer or not!317 */318 for (ObjectList<FormationController>::iterator it =319 ObjectList<FormationController>::begin();320 it != ObjectList<FormationController>::end(); ++it )321 {322 orxout(user_warning) << "Test! Master: " << it->getMaster()323 << " My controller: " << this->getPlayer()->getController() << endl;324 }325 /* TEST TEST */326 327 328 329 330 346 this->setHealth(1); 331 347 if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_)) … … 339 355 this->getGametype()->pawnKilled(this, this->lastHitOriginator_); 340 356 357 341 358 if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this) 359 { 360 if(this->hasSlaves()) 361 { 362 // start to control a slave 363 this->getPlayer()->startControl(this->getSlave()->getControllableEntity()); 364 } 342 365 this->getPlayer()->stopControl(); 343 344 if (GameMode::isMaster())366 } 367 /*if (GameMode::isMaster()) 345 368 { 346 369 // this->deathEffect(); 347 370 this->goWithStyle(); 348 } 371 }*/ 349 372 } 350 373 } -
code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.h
r9348 r9613 185 185 186 186 virtual void death(); 187 virtual bool hasSlaves(); 188 virtual Controller* getSlave(); 187 189 virtual void goWithStyle(); 188 190 virtual void deatheffect();
Note: See TracChangeset
for help on using the changeset viewer.