Changeset 5356 in orxonox.OLD for trunk/src/world_entities/weapons/weapon.cc
- Timestamp:
- Oct 10, 2005, 8:17:44 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/weapon.cc
r5355 r5356 102 102 static_cast<WorldEntity*>(this)->loadParams(root); 103 103 104 LoadParam<Weapon>(root, "projectile", this, &Weapon::setProjectile )104 LoadParam<Weapon>(root, "projectile", this, &Weapon::setProjectileType) 105 105 .describe("Sets the name of the Projectile to load onto the Entity"); 106 106 … … 122 122 * be aware, that this function does not create Factories, as this is job of Bullet-classes. 123 123 */ 124 void Weapon::setProjectile (ClassID projectile)124 void Weapon::setProjectileType(ClassID projectile) 125 125 { 126 126 if (projectile == CL_NULL) … … 148 148 * @param projectile the Name of the Projectile. 149 149 */ 150 void Weapon::setProjectile (const char* projectile)150 void Weapon::setProjectileType(const char* projectile) 151 151 { 152 152 if (projectile == NULL) … … 155 155 if (tmpFac != NULL) 156 156 { 157 this->setProjectile(tmpFac->getStoredID()); 158 } 159 else 160 { 161 PRINTF(2)("Projectile %s does not exist for weapon %s\n", projectile, this->getName()); 162 } 163 } 157 this->setProjectileType(tmpFac->getStoredID()); 158 } 159 else 160 { 161 PRINTF(1)("Projectile %s does not exist for weapon %s\n", projectile, this->getName()); 162 } 163 } 164 165 /** 166 * prepares Projectiles of the Weapon 167 * @param count how many Projectiles to create 168 */ 169 void Weapon::prepareProjectiles(unsigned int count) 170 { 171 if (this->projectileFactory != NULL) 172 projectileFactory->prepare(count); 173 else 174 PRINTF(2)("unable to create %d projectile for Weapon %s\n", count, this->getName()); 175 } 176 177 /** 178 * resurects and returns a Projectile 179 * @returns a Projectile on success, NULL on error (ProjectileFastFactory not Found) 180 */ 181 Projectile* Weapon::getProjectile() 182 { 183 if (this->projectileFactory) 184 return dynamic_cast<Projectile*>(this->projectileFactory->resurrect()); 185 else 186 { 187 PRINTF(2)("No projectile defined for Weapon %s cant return any\n", this->getName()); 188 return NULL; 189 } 190 } 191 164 192 165 193 /**
Note: See TracChangeset
for help on using the changeset viewer.