- Timestamp:
- Nov 13, 2007, 9:25:37 PM (16 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.