Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-09-20 16:30:45 +0000
committerStijn Buys <ingar@osirion.org>2010-09-20 16:30:45 +0000
commite40f70a3af1142e6c0c89c6ea2ee47b996495661 (patch)
treeba70a909b5066ad0e07e2f4eb8bc98684e4598e6 /src/core/inventory.cc
parente8f7c4a06fce9e41fb23ffc42a566501a78210cb (diff)
corrected trading inconsistencies, improved trade window, initial slider widget
Diffstat (limited to 'src/core/inventory.cc')
-rw-r--r--src/core/inventory.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/inventory.cc b/src/core/inventory.cc
index 03cd21e..4b9a2e5 100644
--- a/src/core/inventory.cc
+++ b/src/core/inventory.cc
@@ -97,5 +97,14 @@ void Inventory::recalculate()
}
}
+const long Inventory::max_amount(const long credits, const long price, const float volume) const
+{
+ if ((price * volume) == 0) {
+ return 0;
+ }
+
+ return math::min((long)(capacity_available() / volume), credits / price);
+}
+
} // namespace core