aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/pink/objects/inventory.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 3a0dd786ff..859b96a6be 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -178,14 +178,13 @@ void InventoryMgr::showNextItem(bool direction) {
}
}
- uint i = 0;
- do {
+ for (uint i = 0; i < _items.size(); ++i) {
index = (direction == kLeft) ? index - 1 : index + 1;
- } while (_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
-
- if (i != _items.size()) {
- _item = _items[index % _items.size()];
- _itemActor->setAction(_item->getName());
+ if (_items[index % _items.size()]->getCurrentOwner() == _item->getCurrentOwner()) {
+ _item = _items[index % _items.size()];
+ _itemActor->setAction(_item->getName());
+ break;
+ }
}
}