diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/inventory.cpp | 19 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes3.cpp | 2 |
2 files changed, 10 insertions, 11 deletions
diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index b7864bc6a7..ca05575ec5 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -191,25 +191,24 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { // Remove the item from the inventory list _inventoryList.remove_at(invIndex); - if (invIndex > userInterface._inventoryTopIndex) { + if (!noSelection) { + if (selectedIndex >= invIndex) + --selectedIndex; + if (selectedIndex < 0 && _inventoryList.size() > 0) + selectedIndex = 0; + } + + if (invIndex <= userInterface._inventoryTopIndex) { userInterface._inventoryTopIndex = MAX(userInterface._inventoryTopIndex, 0); } userInterface._inventoryChanged = true; (*this)[objectId]._roomNumber = newScene; - int newIndex = selectedIndex; - if (!noSelection) { - if (newIndex >= invIndex) - --newIndex; - if (newIndex < 0 && size() > 0) - newIndex = 0; - } - if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && _vm->_game->_screenObjects._inputMode == kInputBuildingSentences) { userInterface.categoryChanged(); - userInterface.selectObject(newIndex); + userInterface.selectObject(selectedIndex); } } diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 23a6838245..0ae7995268 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -303,7 +303,7 @@ void Scene302::step() { _game._objects.setRoom(OBJ_DEAD_FISH, 1); _game._objects.setRoom(OBJ_BURGER, 1); - int count = (int)_game._objects._inventoryList.size(); + int count = (int)_game._objects.size(); for (int idx = 0; idx < count; idx++) { if (_game._objects.isInInventory(idx)) _game._objects.setRoom(idx, 50); |