From 98830dde139e963b86d5f4317cb06a674ce6a3a1 Mon Sep 17 00:00:00 2001 From: Chris H Date: Sat, 2 Feb 2019 23:23:17 -0500 Subject: [PATCH 1/2] Fix Jhoira Avatar crashing since it copies cards into no zone --- .../forge/player/PlayerControllerHuman.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java index 7777f319c58..5a99fc19b89 100644 --- a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java +++ b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java @@ -351,20 +351,27 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont } private boolean useSelectCardsInput(final FCollectionView sourceList) { - if ( FThreads.isGuiThread() ) { return false; } // can't use InputSelect from GUI thread (e.g., DevMode Tutor) + // can't use InputSelect from GUI thread (e.g., DevMode Tutor) + if ( FThreads.isGuiThread() ) { return false; } + // if UI_SELECT_FROM_CARD_DISPLAYS not set use InputSelect only for battlefield and player hand // if UI_SELECT_FROM_CARD_DISPLAYS set and using desktop GUI use InputSelect for any zone that can be shown for (final GameEntity c : sourceList) { if (c instanceof Player) { continue; } - if (!(c instanceof Card)) { - return false; - } + + if (!(c instanceof Card)) { + return false; + } final Zone cz = ((Card) c).getZone(); - final boolean useUiPointAtCard = - cz != null && - (FModel.getPreferences().getPrefBoolean(FPref.UI_SELECT_FROM_CARD_DISPLAYS) && (!GuiBase.getInterface().isLibgdxPort()) ) ? + // Don't try to draw the UI point of a card if it doesn't exist in any zone. + if (cz == null) { + return false; + } + + final boolean useUiPointAtCard = + (FModel.getPreferences().getPrefBoolean(FPref.UI_SELECT_FROM_CARD_DISPLAYS) && (!GuiBase.getInterface().isLibgdxPort())) ? (cz.is(ZoneType.Battlefield) || cz.is(ZoneType.Hand) || cz.is(ZoneType.Library) || cz.is(ZoneType.Graveyard) || cz.is(ZoneType.Exile) || cz.is(ZoneType.Flashback) || cz.is(ZoneType.Command)) : (cz.is(ZoneType.Hand) && cz.getPlayer() == player || cz.is(ZoneType.Battlefield)); @@ -372,7 +379,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont return false; } } - return true; + return true; } @Override From 426c0ca4c8d1bc752aa6859c4ca4b496a6071e45 Mon Sep 17 00:00:00 2001 From: Agetian Date: Sun, 3 Feb 2019 08:20:13 +0300 Subject: [PATCH 2/2] - Formatting fix. --- .../main/java/forge/player/PlayerControllerHuman.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java index 5a99fc19b89..e46f93cd761 100644 --- a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java +++ b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java @@ -352,10 +352,10 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont private boolean useSelectCardsInput(final FCollectionView sourceList) { // can't use InputSelect from GUI thread (e.g., DevMode Tutor) - if ( FThreads.isGuiThread() ) { return false; } + if ( FThreads.isGuiThread() ) { return false; } - // if UI_SELECT_FROM_CARD_DISPLAYS not set use InputSelect only for battlefield and player hand - // if UI_SELECT_FROM_CARD_DISPLAYS set and using desktop GUI use InputSelect for any zone that can be shown + // if UI_SELECT_FROM_CARD_DISPLAYS not set use InputSelect only for battlefield and player hand + // if UI_SELECT_FROM_CARD_DISPLAYS set and using desktop GUI use InputSelect for any zone that can be shown for (final GameEntity c : sourceList) { if (c instanceof Player) { continue; @@ -372,14 +372,14 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont final boolean useUiPointAtCard = (FModel.getPreferences().getPrefBoolean(FPref.UI_SELECT_FROM_CARD_DISPLAYS) && (!GuiBase.getInterface().isLibgdxPort())) ? - (cz.is(ZoneType.Battlefield) || cz.is(ZoneType.Hand) || cz.is(ZoneType.Library) || + (cz.is(ZoneType.Battlefield) || cz.is(ZoneType.Hand) || cz.is(ZoneType.Library) || cz.is(ZoneType.Graveyard) || cz.is(ZoneType.Exile) || cz.is(ZoneType.Flashback) || cz.is(ZoneType.Command)) : (cz.is(ZoneType.Hand) && cz.getPlayer() == player || cz.is(ZoneType.Battlefield)); if (!useUiPointAtCard) { return false; } } - return true; + return true; } @Override