Changeset 198 for code/branches/main_reto_vs05/src/weapon
- Timestamp:
- Nov 13, 2007, 9:25:37 PM (17 years ago)
- 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 32 32 namespace weapon { 33 33 34 AmmunitionDump::AmmunitionDump() 34 AmmunitionDump::AmmunitionDump(int capacity) 35 : stock_(0), capacity_(capacity) 35 36 { 36 37 } … … 41 42 } 42 43 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 } 43 73 } 44 74 } -
code/branches/main_reto_vs05/src/weapon/ammunition_dump.h
r189 r198 41 41 { 42 42 public: 43 AmmunitionDump( );43 AmmunitionDump(int capacity); 44 44 ~AmmunitionDump(); 45 45 46 void store(int quantiy); 47 48 int getAmmunition(int quantity); 49 50 int getStockSize(); 51 46 52 protected: 53 int stock_; 54 int capacity_; 47 55 48 56 protected: -
code/branches/main_reto_vs05/src/weapon/weapon.h
r189 r198 26 26 */ 27 27 28 #if 0 28 29 29 30 #ifndef WEAPON_H … … 42 43 public: 43 44 Weapon(const Ogre::String &name, int firePower, int firingRate, 44 Ogre::Real bulletSpeed )45 Ogre::Real bulletSpeed, int magazineSize) 45 46 : name_(name), firePower_(firePower), firingRate_(firingRate), 46 bulletSpeed_(bulletSpeed) { }47 bulletSpeed_(bulletSpeed), magazineSize_(magazineSize) { } 47 48 48 49 virtual ~Weapon() { } … … 53 54 int firingRate_; 54 55 Ogre::Real bulletSpeed_; 56 int magazineSize_; 55 57 }; 56 58 … … 59 61 60 62 #endif /* WEAPON_H */ 63 64 #endif
Note: See TracChangeset
for help on using the changeset viewer.