Changeset 5973 in orxonox.OLD for branches/powerups/src/world_entities/power_ups/weapon_power_up.cc
- Timestamp:
- Dec 7, 2005, 5:02:50 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/powerups/src/world_entities/power_ups/weapon_power_up.cc
r5965 r5973 22 22 23 23 #include "primitive_model.h" 24 25 #include "factory.h" 26 #include "load_param.h" 24 27 25 28 using namespace std; … … 52 55 { 53 56 static_cast<PowerUp*>(this)->loadParams(root); 54 57 const TiXmlElement* elem = root->FirstChildElement("weapon"); 58 if(elem != NULL && (elem = weapon->getFirstChildElement()) != NULL) 59 { 60 this->weaponXML = elem; 61 createWeapon(); 62 } 63 else 64 { 65 LoadParam(root, "weaponID", this, const char*, setWeaponClass); 66 } 55 67 } 56 68 57 69 Weapon* WeaponPowerUp::getWeapon() 58 70 { 59 return dynamic_cast<Weapon*>(Factory::getFirst()->fabricate(this->getWeaponID()));71 return this->weapon; 60 72 } 61 73 62 ClassID WeaponPowerUp::getWeaponID()74 void WeaponPowerUp::createWeapon() 63 75 { 64 return this->weaponID; 76 this->weapon = dynamic_cast<Weapon*>((weaponXML == NULL) 77 ? Factory::getFirst()->fabricate(static_cast<ClassID>(this->weapon->getClassID())) 78 : Factory::getFirst()->fabricate(weaponXML)); 65 79 } 66 80 67 long WeaponPowerUp::getCapsNeeded()81 void WeaponPowerUp::setWeaponClass(const char* name) 68 82 { 69 return this->capsNeeded;83 this->weapon = dynamic_cast<Weapon*>(Factory::getFirst()->fabricate(name, name)); 70 84 }
Note: See TracChangeset
for help on using the changeset viewer.