Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 13, 2007, 9:25:37 PM (17 years ago)
Author:
rgrieder
Message:
  • added a simple ammo dump
  • created BaseWeapon from WeaponManager
  • created the WeaponStation object
Location:
code/branches/main_reto_vs05/src/weapon
Files:
4 added
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/main_reto_vs05/src/weapon/ammunition_dump.cc

    r189 r198  
    3232namespace weapon {
    3333
    34   AmmunitionDump::AmmunitionDump()
     34  AmmunitionDump::AmmunitionDump(int capacity)
     35        : stock_(0), capacity_(capacity)
    3536  {
    3637  }
     
    4142  }
    4243
     44 
     45  void AmmunitionDump::store(int quantity)
     46  {
     47    stock_ += quantity;
     48    if (stock_ > capacity_)
     49      stock_ = capacity_;
     50  }
     51
     52
     53  int AmmunitionDump::getAmmunition(int quantity)
     54  {
     55    if (stock_ >= quantity)
     56    {
     57      stock_ -= quantity;
     58      return quantity;
     59    }
     60    else
     61    {
     62      quantity = stock_;
     63      stock_ = 0;
     64      return quantity;
     65    }
     66  }
     67
     68
     69  int AmmunitionDump::getStockSize()
     70  {
     71    return stock_;
     72  }
    4373}
    4474}
  • code/branches/main_reto_vs05/src/weapon/ammunition_dump.h

    r189 r198  
    4141  {
    4242  public:
    43           AmmunitionDump();
     43          AmmunitionDump(int capacity);
    4444          ~AmmunitionDump();
    4545
     46    void store(int quantiy);
     47
     48    int getAmmunition(int quantity);
     49
     50    int getStockSize();
     51
    4652  protected:
     53    int stock_;
     54    int capacity_;
    4755
    4856  protected:
  • code/branches/main_reto_vs05/src/weapon/weapon.h

    r189 r198  
    2626 */
    2727
     28#if 0
    2829
    2930#ifndef WEAPON_H
     
    4243  public:
    4344    Weapon(const Ogre::String &name, int firePower, int firingRate,
    44       Ogre::Real bulletSpeed)
     45      Ogre::Real bulletSpeed, int magazineSize)
    4546          : name_(name), firePower_(firePower), firingRate_(firingRate),
    46           bulletSpeed_(bulletSpeed) { }
     47          bulletSpeed_(bulletSpeed), magazineSize_(magazineSize) { }
    4748
    4849    virtual ~Weapon() { }
     
    5354    int firingRate_;
    5455    Ogre::Real bulletSpeed_;
     56    int magazineSize_;
    5557  };
    5658
     
    5961
    6062#endif /* WEAPON_H */
     63
     64#endif
Note: See TracChangeset for help on using the changeset viewer.