v0.9.4: improved unequipped item handling when invent is lost
This commit is contained in:
parent
4c1300aa21
commit
440694cd47
|
@ -127,12 +127,16 @@ public abstract class EquipableItem extends Item {
|
||||||
hero.spend( time2equip( hero ) );
|
hero.spend( time2equip( hero ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//temporarily keep this item so it can be collected
|
||||||
|
boolean wasKept = keptThoughLostInvent;
|
||||||
|
keptThoughLostInvent = true;
|
||||||
if (!collect || !collect( hero.belongings.backpack )) {
|
if (!collect || !collect( hero.belongings.backpack )) {
|
||||||
onDetach();
|
onDetach();
|
||||||
Dungeon.quickslot.clearItem(this);
|
Dungeon.quickslot.clearItem(this);
|
||||||
updateQuickslot();
|
updateQuickslot();
|
||||||
if (collect) Dungeon.level.drop( this, hero.pos );
|
if (collect) Dungeon.level.drop( this, hero.pos );
|
||||||
}
|
}
|
||||||
|
keptThoughLostInvent = wasKept;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,9 +130,8 @@ public class WndResurrect extends Window {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean itemSelectable(Item item) {
|
public boolean itemSelectable(Item item) {
|
||||||
//cannot select ankhs, bags or equippable items that aren't equipped
|
//cannot select ankhs or bags or equippable items that aren't equipped
|
||||||
return !(item instanceof Ankh) && !(item instanceof Bag) &&
|
return !(item instanceof Ankh || item instanceof Bag);
|
||||||
(!(item instanceof EquipableItem) || item.isEquipped(Dungeon.hero) || item instanceof MissileWeapon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user