v2.1.1: fixed crash errors with inventory radial menu and targeting
This commit is contained in:
@@ -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 &&
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user