[Scummvm-cvs-logs] scummvm master -> 3e9c1ea50a401ac27cbf0ea442d4e72c8087f902

dreammaster dreammaster at scummvm.org
Sat May 31 01:25:49 CEST 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3e9c1ea50a MADS: Fix confiscating player's inventory when captured


Commit: 3e9c1ea50a401ac27cbf0ea442d4e72c8087f902
    https://github.com/scummvm/scummvm/commit/3e9c1ea50a401ac27cbf0ea442d4e72c8087f902
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-05-30T19:25:13-04:00

Commit Message:
MADS: Fix confiscating player's inventory when captured

Changed paths:
    engines/mads/inventory.cpp
    engines/mads/nebular/nebular_scenes3.cpp



diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp
index b7864bc..ca05575 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 23a6838..0ae7995 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);






More information about the Scummvm-git-logs mailing list