Changeset 6142 in orxonox.OLD for trunk/src/world_entities/weapons
- Timestamp:
- Dec 16, 2005, 7:13:57 PM (19 years ago)
- Location:
- trunk/src/world_entities/weapons
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/aim.cc
r6078 r6142 104 104 void Aim::searchTarget(float range) 105 105 { 106 tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator(); 106 //FIXME// 107 /* tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator(); 107 108 WorldEntity* entity = iterator->firstElement(); 108 109 while (likely(entity != NULL)) … … 121 122 } 122 123 123 delete iterator; 124 delete iterator;*/ 124 125 } 125 126 -
trunk/src/world_entities/weapons/bomb.cc
r5994 r6142 174 174 void Bomb::activate() 175 175 { 176 State::getWorldEntityList()->add(this);177 176 178 177 } … … 180 179 void Bomb::deactivate() 181 180 { 182 State::getWorldEntityList()->remove(this);181 this->toList(OM_DEAD); 183 182 this->lifeCycle = 0.0f; 184 183 Bomb::fastFactory->kill(this); -
trunk/src/world_entities/weapons/ground_turret.cc
r5994 r6142 89 89 { 90 90 this->left->setParent(this); 91 this->left->toList(this->getOMListNumber()); 91 92 this->left->setRelCoor(0,10,-5); 92 93 } … … 98 99 { 99 100 this->right->setParent(this); 101 this->right->toList(this->getOMListNumber()); 100 102 this->right->setRelCoor(0,10,5); 101 103 } -
trunk/src/world_entities/weapons/guided_missile.cc
r6078 r6142 85 85 void GuidedMissile::activate() 86 86 { 87 State::getWorldEntityList()->add(this);88 87 if (unlikely(GuidedMissile::trailParticles == NULL)) 89 88 { … … 129 128 this->lifeCycle = 0.0; 130 129 131 // GarbageCollector::getInstance()->collect(this); 132 State::getWorldEntityList()->remove(this); 130 this->toList(OM_DEAD); 133 131 this->removeNode(); 134 132 GuidedMissile::fastFactory->kill(this); … … 152 150 if (this->target != NULL && this->target->getParent() != PNode::getNullParent()) 153 151 { 154 printf("========%s::%s\n", target->getParent()->getClassName(), target->getParent()->getName() );155 152 velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility; 156 153 float speed = velocity.len(); -
trunk/src/world_entities/weapons/laser.cc
r6056 r6142 77 77 void Laser::activate() 78 78 { 79 State::getWorldEntityList()->add(this);80 79 if (unlikely(Laser::explosionParticles == NULL)) 81 80 { … … 98 97 this->lifeCycle = 0.0; 99 98 100 // GarbageCollector::getInstance()->collect(this); 101 State::getWorldEntityList()->remove(this); 99 this->toList(OM_NULL); 102 100 this->removeNode(); 103 101 Laser::fastFactory->kill(this); … … 134 132 this->lifeCycle = .95; //!< @todo calculate this usefully. 135 133 ParticleEngine::getInstance()->addConnection(this->emitter, Laser::explosionParticles); 136 137 134 } 138 135 -
trunk/src/world_entities/weapons/projectile.cc
r6078 r6142 22 22 #include "weapon.h" 23 23 #include "model.h" 24 25 #include "garbage_collector.h"26 24 27 25 using namespace std; -
trunk/src/world_entities/weapons/rocket.cc
r6056 r6142 82 82 void Rocket::activate() 83 83 { 84 State::getWorldEntityList()->add(this);85 84 if (unlikely(Rocket::trailParticles == NULL)) 86 85 { … … 125 124 ParticleEngine::getInstance()->breakConnections(this->emitter); 126 125 this->lifeCycle = 0.0; 126 this->toList(OM_NULL); 127 127 128 128 // GarbageCollector::getInstance()->collect(this); 129 State::getWorldEntityList()->remove(this);129 this->toList(OM_DEAD); 130 130 Rocket::fastFactory->kill(this); 131 131 } -
trunk/src/world_entities/weapons/test_bullet.cc
r5994 r6142 82 82 void TestBullet::activate() 83 83 { 84 State::getWorldEntityList()->add(this);85 84 if (unlikely(TestBullet::trailParticles == NULL)) 86 85 { … … 119 118 ParticleEngine::getInstance()->breakConnections(this->emitter); 120 119 this->lifeCycle = 0.0; 120 this->toList(OM_NULL); 121 121 122 // GarbageCollector::getInstance()->collect(this);123 State::getWorldEntityList()->remove(this);124 122 TestBullet::fastFactory->kill(this); 125 123 } -
trunk/src/world_entities/weapons/weapon.cc
r6054 r6142 192 192 { 193 193 if (likely (this->projectileFactory != NULL)) 194 return dynamic_cast<Projectile*>(this->projectileFactory->resurrect()); 194 { 195 Projectile* pj = dynamic_cast<Projectile*>(this->projectileFactory->resurrect()); 196 pj->toList((OM_LIST)(this->getOMListNumber()+1)); 197 return pj; 198 } 195 199 else 196 200 { -
trunk/src/world_entities/weapons/weapon_manager.cc
r6074 r6142 35 35 * @param number of weapon slots of the model/ship <= 8 (limitied) 36 36 */ 37 WeaponManager::WeaponManager( PNode* parent)37 WeaponManager::WeaponManager(WorldEntity* parent) 38 38 { 39 39 this->init(); … … 155 155 * a PNode. 156 156 */ 157 void WeaponManager::setParent(PNode* parent) 158 { 159 if (parent == NULL) 160 parent = PNode::getNullParent(); 157 void WeaponManager::setParent(WorldEntity* parent) 158 { 161 159 this->parent = parent; 162 160 if (this->parent != NULL) … … 247 245 this->configs[configID][slotID] = weapon; 248 246 if (this->parent != NULL) 249 weapon->setParent(parent); 247 { 248 this->parent->addChild(weapon); 249 } 250 250 PRINTF(3)("Added a new Weapon to the WeaponManager: config %i/ slot %i\n", configID, slotID); 251 251 } … … 373 373 else 374 374 { 375 if (this->currentSlotConfig[i].currentWeapon != NULL) 376 this->currentSlotConfig[i].currentWeapon->toList(OM_NULL); 375 377 tickWeapon = this->currentSlotConfig[i].currentWeapon = this->currentSlotConfig[i].nextWeapon; 376 378 if (tickWeapon != NULL) … … 378 380 tickWeapon->requestAction(WA_ACTIVATE); 379 381 tickWeapon->setParent(&this->currentSlotConfig[i].position); 382 tickWeapon->toList(this->parent->getOMListNumber()); 380 383 this->currentSlotConfig[i].position.activateNode(); 381 384 } -
trunk/src/world_entities/weapons/weapon_manager.h
r6055 r6142 45 45 46 46 public: 47 WeaponManager( PNode* parent);47 WeaponManager(WorldEntity* parent); 48 48 WeaponManager(const TiXmlElement* root); 49 49 ~WeaponManager(); … … 63 63 long getSlotCapability(int slot) const { return this->currentSlotConfig[slot].capability; }; 64 64 65 void setParent( PNode* parent);65 void setParent(WorldEntity* parent); 66 66 /** @returns the Parent (carrier) of this WeaponManager */ 67 67 PNode* getParent() const { return this->parent; }; … … 93 93 94 94 private: 95 PNode*parent; //!< The parent, this WeaponManager is connected to.95 WorldEntity* parent; //!< The parent, this WeaponManager is connected to. 96 96 97 97 int slotCount; //!< number of weapon slots the ship has.
Note: See TracChangeset
for help on using the changeset viewer.