v2.1.1: fixed crash errors with inventory radial menu and targeting

This commit is contained in:
Evan Debenham
2023-06-05 23:29:14 -04:00
parent c9bed0e0cb
commit 604dead311
3 changed files with 7 additions and 1 deletions

View File

@@ -404,10 +404,15 @@ public class InventoryPane extends Component {
return selector != null;
}
public static void clearTargetingSlot(){
targetingSlot = null;
}
public static void useTargeting(){
if (instance != null &&
instance.visible &&
lastTarget != null &&
targetingSlot != null &&
Actor.chars().contains( lastTarget ) &&
lastTarget.isAlive() &&
lastTarget.alignment != Char.Alignment.ALLY &&

View File

@@ -463,6 +463,7 @@ public class Toolbar extends Component {
if (alt && item.defaultAction() != null) {
item.execute(Dungeon.hero);
} else {
InventoryPane.clearTargetingSlot();
Game.scene().addToFront(new WndUseItem(null, item));
}
}

View File

@@ -55,7 +55,7 @@ public class WndUseItem extends WndInfoItem {
item.execute( Dungeon.hero, action );
}
Item.updateQuickslot();
if (action == item.defaultAction() && item.usesTargeting && owner == null){
if (action.equals(item.defaultAction()) && item.usesTargeting && owner == null){
InventoryPane.useTargeting();
}
}