+
+bool Inventory::AddScenarioItem(const Item *i) {
+ if (scenarioEnd < MaxScenarioItems()) {
+ scenario[scenarioEnd] = i;
+ ++scenarioEnd;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+void Inventory::Sort() {
+ std::sort(entries, entries + 96, Entry::Less);
+}
+
+bool Inventory::Entry::Less(const Entry &lhs, const Entry &rhs) {
+ if (lhs.item) {
+ if (rhs.item) {
+ return Item::Less(*lhs.item, *rhs.item);
+ } else {
+ return true;
+ }
+ } else {
+ return false;
+ }
+}
+
+void Inventory::SwapEntriesAt(int lhs, int rhs) {
+ std::swap(entries[lhs], entries[rhs]);
+}
+