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 | |
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')
-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); |