Changeset 5779 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Nov 26, 2005, 2:20:58 PM (19 years ago)
- Location:
- trunk/src/world_entities/weapons
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/aim.cc
r5750 r5779 81 81 82 82 this->text = new Text(); 83 this->text->setLayer(this->getLayer()); 83 84 this->text->setParent2D(this); 84 85 this->text->setRelCoor2D(10, -50); -
trunk/src/world_entities/weapons/guided_missile.cc
r5772 r5779 66 66 67 67 /* this is normaly done by World.cc by deleting the ParticleEngine */ 68 if (GuidedMissile::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)-> getSize() <= 1)68 if (GuidedMissile::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1) 69 69 { 70 70 if (ClassList::exists(GuidedMissile::trailParticles, CL_PARTICLE_SYSTEM)) … … 72 72 GuidedMissile::trailParticles = NULL; 73 73 } 74 if (GuidedMissile::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)-> getSize() <= 1)74 if (GuidedMissile::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1) 75 75 { 76 76 if (ClassList::exists(GuidedMissile::explosionParticles, CL_PARTICLE_SYSTEM)) -
trunk/src/world_entities/weapons/laser.cc
r5769 r5779 63 63 64 64 /* this is normaly done by World.cc by deleting the ParticleEngine */ 65 if (Laser::explosionParticles != NULL && ClassList::getList(CL_LASER)-> getSize() <= 1)65 if (Laser::explosionParticles != NULL && ClassList::getList(CL_LASER)->size() <= 1) 66 66 { 67 67 //if (ClassList::exists(Laser::explosionParticles, CL_PARTICLE_SYSTEM)) -
trunk/src/world_entities/weapons/rocket.cc
r5769 r5779 62 62 63 63 /* this is normaly done by World.cc by deleting the ParticleEngine */ 64 if (Rocket::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)-> getSize() <= 1)64 if (Rocket::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1) 65 65 { 66 66 if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM)) … … 68 68 Rocket::trailParticles = NULL; 69 69 } 70 if (Rocket::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)-> getSize() <= 1)70 if (Rocket::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1) 71 71 { 72 72 if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM)) -
trunk/src/world_entities/weapons/test_bullet.cc
r5769 r5779 62 62 63 63 /* this is normaly done by World.cc by deleting the ParticleEngine */ 64 if (TestBullet::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)-> getSize() <= 1)64 if (TestBullet::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1) 65 65 { 66 66 if (ClassList::exists(TestBullet::trailParticles, CL_PARTICLE_SYSTEM)) … … 68 68 TestBullet::trailParticles = NULL; 69 69 } 70 if (TestBullet::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)-> getSize() <= 1)70 if (TestBullet::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1) 71 71 { 72 72 if (ClassList::exists(TestBullet::explosionParticles, CL_PARTICLE_SYSTEM)) -
trunk/src/world_entities/weapons/weapon_manager.cc
r5750 r5779 347 347 if (this->targetIterator == NULL) 348 348 { 349 tList<BaseObject>* npcList = ClassList::getList(CL_NPC);349 std::list<BaseObject*>* npcList = ClassList::getList(CL_NPC); 350 350 if (npcList != NULL) 351 351 { 352 this->targetIterator = npcList->getIterator(); 353 this->targetIterator->firstElement(); 352 this->targetIterator = npcList->begin(); 354 353 } 355 354 else … … 357 356 } 358 357 359 PNode* retNode = dynamic_cast<PNode*>(targetIterator->nextElement()); 360 if (retNode == NULL && this->targetIterator->getList()->getSize() > 0) 361 retNode = dynamic_cast<PNode*>(targetIterator->firstElement()); 358 ///FIXME 359 // this->targetIterator++; 360 PNode* retNode = dynamic_cast<PNode*>((*targetIterator)); 361 // if (retNode == NULL && this->targetIterator->getList()->getSize() > 0) 362 // retNode = dynamic_cast<PNode*>(targetIterator->firstElement()); 362 363 363 364 return retNode; … … 372 373 PNode* WeaponManager::getDistanceTarget(const PNode* carrier, float distance) 373 374 { 374 tList<BaseObject>* npcList = ClassList::getList(CL_NPC);375 std::list<BaseObject*>* npcList = ClassList::getList(CL_NPC); 375 376 if (npcList != NULL) 376 377 { 377 tIterator<BaseObject>* npcIT = npcList->getIterator(); 378 PNode* tmpNPC = dynamic_cast<PNode*>(npcIT->firstElement()); 379 while (tmpNPC != NULL) 380 { 381 if ((carrier->getAbsCoor() - tmpNPC->getAbsCoor()).len() < distance) 382 { 383 delete npcIT; 384 return tmpNPC; 385 } 386 tmpNPC = dynamic_cast<PNode*>(npcIT->nextElement()); 387 } 388 delete npcIT; 378 list<BaseObject*>::iterator node; 379 for (node= npcList->begin(); node != npcList->end(); node++) 380 if ((carrier->getAbsCoor() - dynamic_cast<PNode*>(*node)->getAbsCoor()).len() < distance) 381 return dynamic_cast<PNode*>(*node); 389 382 } 390 383 return this->getFixedTarget(); 391 392 384 } 393 385 -
trunk/src/world_entities/weapons/weapon_manager.h
r5750 r5779 110 110 tAnimation<Crosshair>* crossHairSizeAnim; //!< An animation for the crosshair (scaling) 111 111 112 tIterator<BaseObject>*targetIterator; //!< An iterator for traversion lists of enemies.112 std::list<BaseObject*>::iterator targetIterator; //!< An iterator for traversion lists of enemies. 113 113 };
Note: See TracChangeset
for help on using the changeset viewer.