aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/parallaction/inventory.cpp15
-rw-r--r--engines/parallaction/parallaction.cpp1
-rw-r--r--engines/parallaction/parallaction.h3
3 files changed, 17 insertions, 2 deletions
diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index 21c1da1a70..4d3225cd61 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -262,8 +262,12 @@ Inventory::~Inventory() {
}
ItemPosition Inventory::addItem(ItemName name, uint32 value) {
- if (_numItems == INVENTORY_MAX_ITEMS)
+ debugC(1, kDebugInventory, "addItem(%i, %i)", name, value);
+
+ if (_numItems == INVENTORY_MAX_ITEMS) {
+ debugC(3, kDebugInventory, "addItem: inventory is full");
return -1;
+ }
// NOTE: items whose name == 0 aren't really inventory items,
// but the engine expects the inventory to accept them as valid.
@@ -277,6 +281,8 @@ ItemPosition Inventory::addItem(ItemName name, uint32 value) {
_numItems++;
+ debugC(3, kDebugInventory, "addItem: done");
+
return _numItems;
}
@@ -294,8 +300,11 @@ ItemPosition Inventory::findItem(ItemName name) const {
}
void Inventory::removeItem(ItemName name) {
+ debugC(1, kDebugInventory, "removeItem(%i)", name);
+
ItemPosition pos = findItem(name);
if (pos == -1) {
+ debugC(3, kDebugInventory, "removeItem: can't find item, nothing to remove");
return;
}
@@ -307,9 +316,13 @@ void Inventory::removeItem(ItemName name) {
_items[_numItems]._id = 0;
_items[_numItems]._index = 0;
+
+ debugC(3, kDebugInventory, "removeItem: item removed");
}
void Inventory::clear(bool keepVerbs) {
+ debugC(1, kDebugInventory, "clearInventory()");
+
uint first = (keepVerbs ? INVENTORY_FIRST_ITEM : 0);
for (uint16 slot = first; slot < _maxItems; slot++) {
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 9005585a8e..52c5dd924b 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -112,6 +112,7 @@ Parallaction::Parallaction(OSystem *syst) :
Common::addSpecialDebugLevel(kDebugInput, "input", "Input debug level");
Common::addSpecialDebugLevel(kDebugAudio, "audio", "Audio debug level");
Common::addSpecialDebugLevel(kDebugMenu, "menu", "Menu debug level");
+ Common::addSpecialDebugLevel(kDebugInventory, "inventory", "Inventory debug level");
syst->getEventManager()->registerRandomSource(_rnd, "parallaction");
}
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 5238f8f913..e1420d3a1d 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -53,7 +53,8 @@ enum {
kDebugExec = 1 << 5,
kDebugInput = 1 << 6,
kDebugAudio = 1 << 7,
- kDebugMenu = 1 << 8
+ kDebugMenu = 1 << 8,
+ kDebugInventory = 1 << 9
};
enum {