Bugfix: Only remove one item per click when picking up single items from ground bags

This commit is contained in:
Oskar Wiksten
2013-07-06 12:05:03 +02:00
parent daec6ee814
commit 146c4b795a

View File

@@ -178,13 +178,15 @@ public final class Dialogs {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
final String itemTypeID = ((ItemContainerAdapter) parent.getAdapter()).getItem(position).itemType.id;
boolean removeFromCombinedLoot = true;
for (Loot l : lootBags) {
if (l == combinedLoot) removeFromCombinedLoot = false;
if (l.items.removeItem(itemTypeID)) {
controllers.itemController.removeLootBagIfEmpty(l);
break;
}
}
combinedLoot.items.removeItem(itemTypeID);
if (removeFromCombinedLoot) combinedLoot.items.removeItem(itemTypeID);
ItemType type = world.itemTypes.getItemType(itemTypeID);
world.model.player.inventory.addItem(type);
((ItemContainerAdapter) itemList.getAdapter()).notifyDataSetChanged();