-/*
- * Inventory.cpp
- *
- * Created on: Aug 9, 2012
- * Author: holy
- */
-
#include "Inventory.h"
#include "Item.h"
namespace common {
-Inventory::Inventory() {
+Inventory::Inventory()
+: scenarioEnd(0) {
}
}
+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);
+ std::stable_sort(entries, entries + 96, Entry::Less);
}
bool Inventory::Entry::Less(const Entry &lhs, const Entry &rhs) {