Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 7, 2005, 10:32:23 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: many loadParams

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/weapons/weapon.cc

    r4967 r4972  
    9696}
    9797
     98void Weapon::loadParams(const TiXmlElement* root)
     99{
     100  static_cast<WorldEntity*>(this)->loadParams(root);
     101
     102  LoadParam<Weapon>(root, "projectile", this, &Weapon::setProjectile)
     103      .describe("Sets the name of the Projectile to load onto the Entity");
     104
     105  LoadParam<Weapon>(root, "emission-point", this, &Weapon::setEmissionPoint)
     106      .describe("Sets the Point of emission of this weapon");
     107
     108  LoadParam<Weapon>(root, "state-duration", this, &Weapon::setStateDuration)
     109      .describe("Sets the duration of a given state (1: state-Name; 2: duration in seconds)");
     110
     111  LoadParam<Weapon>(root, "action-sound", this, &Weapon::setActionSound)
     112      .describe("Sets a given sound to an action (1: action-Name; 2: name of the sound (relative to the Data-Path))");
     113}
     114
    98115/**
    99116 * sets the Projectile to use for this weapon.
     
    103120 * be aware, that this function does not create Factories, as this is job of Bullet-classes.
    104121 */
    105 bool Weapon::setProjectile(ClassID projectile)
     122void Weapon::setProjectile(ClassID projectile)
    106123{
    107124  if (projectile == CL_NULL)
    108     return false;
     125    return;
    109126  this->projectile = projectile;
    110127  this->projectileFactory = FastFactory::searchFastFactory(projectile);
    111128  if (this->projectileFactory == NULL)
    112     return false;
     129    return;
    113130  else
    114131  {
     
    125142 * @see bool Weapon::setProjectile(ClassID projectile)
    126143 * @param projectile the Name of the Projectile.
    127  * @return true if
    128  */
    129 bool Weapon::setProjectile(const char* projectile)
     144 */
     145void Weapon::setProjectile(const char* projectile)
    130146{
    131147  if (projectile == NULL)
    132     return false;
     148    return;
    133149  FastFactory* tmpFac = FastFactory::searchFastFactory(projectile);
    134150  if (tmpFac != NULL)
    135151  {
    136152    this->setProjectile(tmpFac->getStoredID());
     153  }
     154  else
     155  {
     156    PRINTF(2)("Projectile %s does not exist for weapon %s\n", projectile, this->getName());
    137157  }
    138158}
Note: See TracChangeset for help on using the changeset viewer.