From c68871860ab58ebb8cdb5f31615a39caa79c1c6f Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sun, 21 Oct 2007 13:10:36 +0000 Subject: Added new debug level for inventory routines. svn-id: r29239 --- engines/parallaction/inventory.cpp | 15 ++++++++++++++- engines/parallaction/parallaction.cpp | 1 + engines/parallaction/parallaction.h | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'engines/parallaction') 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 { -- cgit v1.2.3