v2.0.0: item selectors now pick backpack if preferred back isn't present

This commit is contained in:
Evan Debenham
2023-01-10 11:58:10 -05:00
parent 9602cedbd0
commit 1bc40109dc
2 changed files with 6 additions and 2 deletions

View File

@@ -393,7 +393,9 @@ public class InventoryPane extends Component {
lastBag = Dungeon.hero.belongings.backpack;
} else if (selector.preferredBag() != null) {
Bag preferred = Dungeon.hero.belongings.getItem(selector.preferredBag());
if (preferred != null) lastBag = preferred;
if (preferred != null) lastBag = preferred;
//if a specific preferred bag isn't present, then the relevant items will be in backpack
else lastBag = Dungeon.hero.belongings.backpack;
}
updateInventory();
}

View File

@@ -167,7 +167,9 @@ public class WndBag extends WndTabbed {
} else if (selector.preferredBag() != null){
Bag bag = Dungeon.hero.belongings.getItem( selector.preferredBag() );
if (bag != null) return new WndBag( bag, selector );
if (bag != null) return new WndBag( bag, selector );
//if a specific preferred bag isn't present, then the relevant items will be in backpack
else return new WndBag( Dungeon.hero.belongings.backpack, selector );
}
return lastBag( selector );