aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/inventory.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp
index 434d284244..b7864bc6a7 100644
--- a/engines/mads/inventory.cpp
+++ b/engines/mads/inventory.cpp
@@ -150,10 +150,10 @@ void InventoryObjects::addToInventory(int objectId) {
_inventoryList.push_back(objectId);
userInterface._selectedInvIndex = _inventoryList.size() - 1;
userInterface._inventoryTopIndex = CLIP(userInterface._inventoryTopIndex,
- 0, (int)_inventoryList.size() - 1);
+ 0, userInterface._selectedInvIndex);
if ((userInterface._inventoryTopIndex + 5) <= (int)_inventoryList.size())
- userInterface._inventoryTopIndex = size() - 4;
+ userInterface._inventoryTopIndex = _inventoryList.size() - 5;
userInterface._inventoryChanged = true;
(*this)[objectId]._roomNumber = PLAYER_INVENTORY;