Changeset 6973 in orxonox.OLD for trunk/src/world_entities/power_ups/weapon_power_up.cc
- Timestamp:
- Feb 2, 2006, 10:20:16 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/power_ups/weapon_power_up.cc
r6815 r6973 53 53 this->setClassID(CL_WEAPON_POWER_UP, "WeaponPowerUp"); 54 54 this->weaponXML = NULL; 55 this->weaponID = CL_NULL;56 55 this->weapon = NULL; 57 56 } … … 65 64 { 66 65 this->weaponXML = elem; 67 respawn();66 newWeapon(); 68 67 } 69 68 else … … 78 77 } 79 78 80 void WeaponPowerUp::respawn() 79 bool WeaponPowerUp::process(WeaponManager* manager) 80 { 81 if(manager->addWeapon(this->weapon)) { 82 newWeapon(); 83 } 84 else { 85 manager->increaseAmmunition(this->weapon->getProjectileType(), this->weapon->getEnergy()); 86 } 87 return true; 88 } 89 90 void WeaponPowerUp::newWeapon() 81 91 { 82 92 this->weapon = dynamic_cast<Weapon*>((weaponXML == NULL) 83 ? Factory::fabricate(static_cast<ClassID>( weaponID))93 ? Factory::fabricate(static_cast<ClassID>(this->weapon->getLeafClassID())) 84 94 : Factory::fabricate((TiXmlElement*)this->getXmlElem()->FirstChildElement("weapon"))); 85 95 this->model = this->weapon->getModel(0); … … 89 99 { 90 100 this->weapon = dynamic_cast<Weapon*>(Factory::fabricate(name)); 91 this->weaponID = (ClassID)this->weapon->getLeafClassID();92 101 this->model = this->weapon->getModel(0); 93 102 }
Note: See TracChangeset
for help on using the changeset viewer.