v0.4.0: improved some interactions with full inventories

This commit is contained in:
Evan Debenham
2016-06-12 20:52:34 -04:00
committed by Evan Debenham
parent edbb426764
commit 65b0a40865
2 changed files with 12 additions and 8 deletions
@@ -65,17 +65,19 @@ public class Bag extends Item implements Iterable<Item> {
@Override
public boolean collect( Bag container ) {
for (Item item : container.items.toArray( new Item[0] )) {
if (grab( item )) {
item.detachAll( container );
if (!item.collect( this ))
item.collect( container );
}
}
if (super.collect( container )) {
owner = container.owner;
for (Item item : container.items.toArray( new Item[0] )) {
if (grab( item )) {
item.detachAll( container );
item.collect( this );
}
}
Badges.validateAllBagsBought( this );
return true;