diff options
author | Paul Gilbert | 2014-05-30 19:25:13 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-05-30 19:25:13 -0400 |
commit | 3e9c1ea50a401ac27cbf0ea442d4e72c8087f902 (patch) | |
tree | ce0419c8a4262d976e632ec5e060f03e3518ea60 /engines/mads/inventory.cpp | |
parent | 00a0a412bb52106982dbfaae3c8c0ab3de396dd6 (diff) | |
download | scummvm-rg350-3e9c1ea50a401ac27cbf0ea442d4e72c8087f902.tar.gz scummvm-rg350-3e9c1ea50a401ac27cbf0ea442d4e72c8087f902.tar.bz2 scummvm-rg350-3e9c1ea50a401ac27cbf0ea442d4e72c8087f902.zip |
MADS: Fix confiscating player's inventory when captured
Diffstat (limited to 'engines/mads/inventory.cpp')
-rw-r--r-- | engines/mads/inventory.cpp | 19 |
1 files changed, 9 insertions, 10 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); } } |