int SimpleGoodStore::getMaxStore(const Good::Type goodType) { int freeRoom = 0; if( !isDevastation() ) { int globalFreeRoom = getMaxQty() - getCurrentQty(); // current free capacity freeRoom = math::clamp( _goodStockList[goodType]._maxQty - _goodStockList[goodType]._currentQty, 0, globalFreeRoom ); // remove all storage reservations foreach( _Reservations::value_type& item, _getStoreReservations() ) { freeRoom -= item.second._currentQty; } }
int SimpleGoodStore::getMaxStore(const GoodType goodType) { int freeRoom = 0; if( !isDevastation() ) { int globalFreeRoom = getMaxQty() - getCurrentQty(); // current free capacity freeRoom = math::clamp( _goodStockList[goodType]._maxQty - _goodStockList[goodType]._currentQty, 0, globalFreeRoom ); // remove all storage reservations for( _Reservations::iterator reservationIt = _getStoreReservations().begin(); \ reservationIt != _getStoreReservations().end(); ++reservationIt) { GoodStock &reservationStock = reservationIt->second; freeRoom -= reservationStock._currentQty; } } return freeRoom; }