Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6561 in orxonox.OLD for trunk/src/world_entities/weapons


Ignore:
Timestamp:
Jan 18, 2006, 3:00:56 PM (19 years ago)
Author:
bensch
Message:

trunk: WeaponManager update

Location:
trunk/src/world_entities/weapons
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/turret.cc

    r6547 r6561  
    9494  this->setProjectileType(CL_ROCKET);
    9595
     96  this->loadModel("models/guns/turret1.obj");
    9697
    9798  this->setEmissionPoint(1.684, 0.472, 0);
     
    102103{
    103104  Weapon::loadParams(root);
    104 
    105105}
    106106
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r6512 r6561  
    2222#include "weapon.h"
    2323#include "crosshair.h"
     24
     25#include "playable.h"
    2426
    2527#include "load_param.h"
     
    213215 * a error message.
    214216 */
    215 void WeaponManager::addWeapon(Weapon* weapon, int configID, int slotID)
     217bool WeaponManager::addWeapon(Weapon* weapon, int configID, int slotID)
    216218{
    217219  if (unlikely(configID >= WM_MAX_CONFIGS || slotID >= (int)this->slotCount))
    218220  {
    219221    PRINTF(2)("Slot %d of config %d is not availiabe (max: %d)\n", slotID, configID, this->slotCount);
    220     return;
     222    return false;
    221223  }
    222224
     
    230232    {
    231233      PRINTF(1)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n");
    232       return;
     234      return false;
    233235    }
    234236  }
     
    239241    PRINTF(2)("Unable to add Weapon with wrong capatibility to Slot %d (W:%d M:%d)\n",
    240242              slotID, weapon->getCapability(), this->currentSlotConfig[slotID].capability);
    241     return;
     243    return false;
    242244  }
    243245
     
    249251  }
    250252  PRINTF(3)("Added a new Weapon to the WeaponManager: config %i/ slot %i\n", configID, slotID);
     253  return true;
    251254}
    252255
  • trunk/src/world_entities/weapons/weapon_manager.h

    r6512 r6561  
    7171    PNode* getParent() const { return this->parent; };
    7272
    73     void addWeapon(Weapon* weapon, int configID = -1, int slotID = -1);
     73    bool addWeapon(Weapon* weapon);
     74    bool addWeapon(Weapon* weapon, int configID = -1, int slotID = -1);
    7475    void removeWeapon(Weapon* weapon, int configID = -1);
    7576    Weapon* getWeapon(int slotID) const { return (slotID >= 0 && slotID < this->slotCount)? this->currentSlotConfig[slotID].nextWeapon: NULL; };
Note: See TracChangeset for help on using the changeset viewer.