Changeset 9705 in orxonox.OLD for branches/new_class_id/src/world_entities/weapons/weapon.cc
- Timestamp:
- Aug 25, 2006, 9:44:53 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/world_entities/weapons/weapon.cc
r9406 r9705 25 25 26 26 #include "util/loading/resource_manager.h" 27 #include "class_list.h"28 27 #include "util/loading/factory.h" 29 28 #include "util/loading/load_param.h" … … 36 35 #include "elements/glgui_energywidget.h" 37 36 38 37 NewObjectListDefinition(Weapon); 39 38 40 39 //////////////////// … … 58 57 { 59 58 for (int i = 0; i < WS_STATE_COUNT; i++) 60 if (this->animation[i] && ClassList::exists(animation[i], CL_ANIMATION)) //!< @todo this should check animation3D59 if (this->animation[i] && Animation::objectList().exists(animation[i])) //!< @todo this should check animation3D 61 60 delete this->animation[i]; 62 61 for (int i = 0; i < WA_ACTION_COUNT; i++) 63 if (this->soundBuffers[i] != NULL && ClassList::exists(this->soundBuffers[i], CL_SOUND_BUFFER))62 if (this->soundBuffers[i] != NULL && OrxSound::SoundBuffer::objectList().exists(this->soundBuffers[i])) 64 63 ResourceManager::getInstance()->unload(this->soundBuffers[i]); 65 64 66 if ( ClassList::exists(this->soundSource, CL_SOUND_SOURCE))65 if (OrxSound::SoundSource::objectList().exists(this->soundSource)) 67 66 delete this->soundSource; 68 67 } … … 73 72 * @returns the newly created Weapon. 74 73 */ 75 Weapon* Weapon::createWeapon( ClassIDweaponID)74 Weapon* Weapon::createWeapon(const NewClassID& weaponID) 76 75 { 77 76 BaseObject* createdObject = Factory::fabricate(weaponID); 78 77 if (createdObject != NULL) 79 78 { 80 if (createdObject->isA( CL_WEAPON))79 if (createdObject->isA(Weapon::classID())) 81 80 return dynamic_cast<Weapon*>(createdObject); 82 81 else … … 89 88 } 90 89 90 Weapon* Weapon::createWeapon(const std::string& weaponName) 91 { 92 BaseObject* createdObject = Factory::fabricate(weaponName); 93 if (createdObject != NULL) 94 { 95 if (createdObject->isA(Weapon::classID())) 96 return dynamic_cast<Weapon*>(createdObject); 97 else 98 { 99 delete createdObject; 100 return NULL; 101 } 102 } 103 return NULL; 104 } 105 106 91 107 /** 92 108 * initializes the Weapon with ALL default values … … 96 112 void Weapon::init() 97 113 { 98 this-> setClassID(CL_WEAPON, "Weapon");114 this->registerObject(this, Weapon::_objectList); 99 115 this->currentState = WS_INACTIVE; //< Normaly the Weapon is Inactive 100 116 this->requestedAction = WA_NONE; //< No action is requested by default … … 115 131 this->defaultTarget = NULL; //< Nothing is Targeted by default. 116 132 117 this->projectile = CL_NULL;//< No Projectile Class is Connected to this weapon133 this->projectile = NullClass::classID(); //< No Projectile Class is Connected to this weapon 118 134 this->projectileFactory = NULL; //< No Factory generating Projectiles is selected. 119 135 … … 163 179 * What it does, is telling the Weapon what Projectiles it can Emit. 164 180 */ 165 void Weapon::setProjectileType(ClassID projectile) 166 { 167 if (projectile == CL_NULL) 168 return; 181 void Weapon::setProjectileType(const NewClassID& projectile) 182 { 169 183 this->projectile = projectile; 170 184 this->projectileFactory = FastFactory::searchFastFactory(projectile);
Note: See TracChangeset
for help on using the changeset viewer.