Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6561 in orxonox.OLD


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

trunk: WeaponManager update

Location:
trunk/src/world_entities
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/creatures/md2_creature.cc

    r6512 r6561  
    208208}
    209209
    210 
    211 /**
    212  * adds a weapon to the weapon list of the MD2Creature
    213  * @param weapon to add
    214 */
    215 void MD2Creature::addWeapon(Weapon* weapon)
    216 {
    217   this->getWeaponManager()->addWeapon(weapon);
    218 }
    219 
    220 
    221 /**
    222  *  removes a weapon from the MD2Creature
    223  * @param weapon to remove
    224 */
    225 void MD2Creature::removeWeapon(Weapon* weapon)
    226 {
    227   this->getWeaponManager()->removeWeapon(weapon);
    228 }
    229210
    230211/**
  • trunk/src/world_entities/creatures/md2_creature.h

    r6512 r6561  
    2929    virtual void enter();
    3030    virtual void leave();
    31 
    32     void addWeapon(Weapon* weapon );
    33     void removeWeapon(Weapon* weapon);
    3431
    3532    virtual void postSpawn();
  • 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.