diff options
-rw-r--r-- | engines/lastexpress/game/inventory.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/engines/lastexpress/game/inventory.cpp b/engines/lastexpress/game/inventory.cpp index 9e02b3bc1d..622d547542 100644 --- a/engines/lastexpress/game/inventory.cpp +++ b/engines/lastexpress/game/inventory.cpp @@ -40,7 +40,6 @@ #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" - namespace LastExpress { Inventory::Inventory(LastExpressEngine *engine) : _engine(engine), _selectedItem(kItemNone), _highlightedItemIndex(0), _itemsShown(0), @@ -534,18 +533,18 @@ Common::String Inventory::toString() { // Private methods ////////////////////////////////////////////////////////////////////////// InventoryItem Inventory::getFirstExaminableItem() const { - int index = 0; - InventoryEntry entry = _entries[index]; - while (!entry.inPocket || !entry.cursor || entry.floating) { - index++; - entry = _entries[index]; + do { + InventoryEntry entry = _entries[index]; - if (index >= kPortraitOriginal) - return kItemNone; - } + // Check if it is an examinable item + if (entry.inPocket && entry.cursor && !entry.floating) + return (InventoryItem)index; + + index++; + } while (index < kPortraitOriginal); - return (InventoryItem)index; + return kItemNone; } bool Inventory::isItemSceneParameter(InventoryItem item) const { |