Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base/cargo.cc')
-rw-r--r--src/game/base/cargo.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/game/base/cargo.cc b/src/game/base/cargo.cc
index 382b03c..b54af55 100644
--- a/src/game/base/cargo.cc
+++ b/src/game/base/cargo.cc
@@ -257,11 +257,17 @@ void Cargo::buy(core::EntityControlable *buyer, core::Entity *seller, const int
}
// if amount is set to -1. the base has a limitless supply
+
if (seller_item->amount() == 0) {
buyer->owner()->send("^WCargo not available!");
return;
- } else if ((seller_item->amount() > 0) && (negotiated_amount > seller_item->amount())) {
- negotiated_amount = seller_item->amount();
+
+ } else if (seller_item->amount() > 0) {
+
+ if (negotiated_amount > seller_item->amount()) {
+ negotiated_amount = seller_item->amount();
+ }
+
seller_item->dec_amount(negotiated_amount);
seller->inventory()->set_dirty();
}