diff --git a/[Help b/[Help new file mode 100644 index 00000000000..e69de29bb2d diff --git a/forge-gui-desktop/src/main/java/forge/gui/GuiChoose.java b/forge-gui-desktop/src/main/java/forge/gui/GuiChoose.java index d9c2f9782a5..86534fdc4a4 100644 --- a/forge-gui-desktop/src/main/java/forge/gui/GuiChoose.java +++ b/forge-gui-desktop/src/main/java/forge/gui/GuiChoose.java @@ -285,7 +285,7 @@ public class GuiChoose { return null; } - public static List manipulateCardList(final CMatchUI gui, final String title, final List cards, final List manipulable, + public static List manipulateCardList(final CMatchUI gui, final String title, final Iterable cards, final Iterable manipulable, final boolean toTop, final boolean toBottom, final boolean toAnywhere) { final Callable> callable = new Callable>() { @Override diff --git a/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java b/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java index 400303463c0..db4efdbbee0 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java +++ b/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java @@ -1004,7 +1004,7 @@ public final class CMatchUI } @Override - public List manipulateCardList(final String title, final List cards, final List manipulable, final boolean toTop, final boolean toBottom, final boolean toAnywhere) { + public List manipulateCardList(final String title, final Iterable cards, final Iterable manipulable, final boolean toTop, final boolean toBottom, final boolean toAnywhere) { return GuiChoose.manipulateCardList(this, title, cards, manipulable, toTop, toBottom, toAnywhere); } diff --git a/forge-gui-desktop/src/main/java/forge/view/arcane/ListCardArea.java b/forge-gui-desktop/src/main/java/forge/view/arcane/ListCardArea.java index 23f7e4b81f5..c73ee2fb66d 100644 --- a/forge-gui-desktop/src/main/java/forge/view/arcane/ListCardArea.java +++ b/forge-gui-desktop/src/main/java/forge/view/arcane/ListCardArea.java @@ -59,11 +59,12 @@ public class ListCardArea extends FloatingCardArea { setOpaque(false); } - public static ListCardArea show(final CMatchUI matchUI, final String title0, final List cardList0, final List moveableCards0, final boolean toTop0, final boolean toBottom0, final boolean toAnywhere0) { + public static ListCardArea show(final CMatchUI matchUI, final String title0, final Iterable cardList0, final Iterable moveableCards0, final boolean toTop0, final boolean toBottom0, final boolean toAnywhere0) { if (storedArea==null) { storedArea = new ListCardArea(matchUI); } - cardList = new ArrayList(cardList0); + cardList = new ArrayList(); + for ( CardView cv : cardList0 ) { cardList.add(cv) ; } moveableCards = new ArrayList(); // make sure moveable cards are in cardlist for ( CardView card : moveableCards0 ) { if ( cardList.contains(card) ) { diff --git a/forge-gui-mobile/src/forge/screens/match/MatchController.java b/forge-gui-mobile/src/forge/screens/match/MatchController.java index 68445b75feb..3eef6be8e79 100644 --- a/forge-gui-mobile/src/forge/screens/match/MatchController.java +++ b/forge-gui-mobile/src/forge/screens/match/MatchController.java @@ -521,7 +521,7 @@ public class MatchController extends AbstractGuiGame { } @Override - public List manipulateCardList(final String title, final List cards, final List manipulable, final boolean toTop, final boolean toBottom, final boolean toAnywhere) { + public List manipulateCardList(final String title, final Iterable cards, final Iterable manipulable, final boolean toTop, final boolean toBottom, final boolean toAnywhere) { System.err.println("Not implemented yet - should never be called"); return null; } diff --git a/forge-gui/src/main/java/forge/interfaces/IGuiGame.java b/forge-gui/src/main/java/forge/interfaces/IGuiGame.java index b36cce98e73..5d16196db30 100644 --- a/forge-gui/src/main/java/forge/interfaces/IGuiGame.java +++ b/forge-gui/src/main/java/forge/interfaces/IGuiGame.java @@ -149,7 +149,7 @@ public interface IGuiGame { List chooseEntitiesForEffect(String title, List optionList, int min, int max, DelayedReveal delayedReveal); // show a list of cards and allow some of them to be moved around and return new list - List manipulateCardList(String title, final List cards, final List manipulable, boolean toTop, boolean toBottom, boolean toAnywhere); + List manipulateCardList(String title, final Iterable cards, final Iterable manipulable, boolean toTop, boolean toBottom, boolean toAnywhere); void setCard(CardView card); void setPlayerAvatar(LobbyPlayer player, IHasIcon ihi); diff --git a/forge-gui/src/main/java/forge/net/ProtocolMethod.java b/forge-gui/src/main/java/forge/net/ProtocolMethod.java index 4642efd5101..b75acdce1cf 100644 --- a/forge-gui/src/main/java/forge/net/ProtocolMethod.java +++ b/forge-gui/src/main/java/forge/net/ProtocolMethod.java @@ -68,7 +68,7 @@ public enum ProtocolMethod { sideboard (Mode.SERVER, List.class, CardPool.class, CardPool.class), chooseSingleEntityForEffect(Mode.SERVER, GameEntityView.class, String.class, List.class, DelayedReveal.class, Boolean.TYPE), chooseEntitiesForEffect(Mode.SERVER, GameEntityView.class, String.class, List.class, Integer.TYPE, Integer.TYPE, DelayedReveal.class), - manipulateCardList (Mode.SERVER, List.class, String.class, List.class, List.class, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE), + manipulateCardList (Mode.SERVER, List.class, String.class, Iterable.class, Iterable.class, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE), setCard (Mode.SERVER, Void.TYPE, CardView.class), // TODO case "setPlayerAvatar": openZones (Mode.SERVER, Boolean.TYPE, Collection/*ZoneType*/.class, Map/*PlayerView,Object*/.class), diff --git a/forge-gui/src/main/java/forge/net/server/NetGuiGame.java b/forge-gui/src/main/java/forge/net/server/NetGuiGame.java index c99368a4e07..4d1174c1760 100644 --- a/forge-gui/src/main/java/forge/net/server/NetGuiGame.java +++ b/forge-gui/src/main/java/forge/net/server/NetGuiGame.java @@ -249,7 +249,7 @@ public class NetGuiGame extends AbstractGuiGame { } @Override - public List manipulateCardList(final String title, final List cards, final List manipulable, final boolean toTop, final boolean toBottom, final boolean toAnywhere) { + public List manipulateCardList(final String title, final Iterable cards, final Iterable manipulable, final boolean toTop, final boolean toBottom, final boolean toAnywhere) { return sendAndWait(ProtocolMethod.manipulateCardList, title, cards, manipulable, toTop, toBottom, toAnywhere); } diff --git a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java index ecdc6157ed5..1a2c2cb43d1 100644 --- a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java +++ b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java @@ -737,25 +737,12 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont } } - public List manipulateCardList(final String title, final List cards, final List manipulable, final boolean toTop, final boolean toBottom, final boolean toAnywhere) { - ArrayList cardViews = new ArrayList(); - for ( Card c : cards ) { cardViews.add(c.getView()); } - ArrayList manipulableViews = new ArrayList(); - for ( Card c : manipulable ) { manipulableViews.add(c.getView()); } - Iterable result = getGui().manipulateCardList(title, cardViews, manipulableViews, toTop, toBottom, toAnywhere); - List resultCards = new ArrayList(); - for ( CardView cv : result ) { - for ( Card card : cards ) { - if ( cv == card.getView() ) { - resultCards.add(card); - break; - } - } - } - return resultCards; + public List manipulateCardList(final String title, final Iterable cards, final Iterable manipulable, final boolean toTop, final boolean toBottom, final boolean toAnywhere) { + Iterable result = getGui().manipulateCardList(title, CardView.getCollection(cards), CardView.getCollection(manipulable), toTop, toBottom, toAnywhere); + return game.getCardList(result); } - public ImmutablePair arrangeForMove(final String title, final List cards, final List manipulable, final boolean topOK, final boolean bottomOK) { + public ImmutablePair arrangeForMove(final String title, final FCollectionView cards, final List manipulable, final boolean topOK, final boolean bottomOK) { List result = manipulateCardList("Move cards to top or bottom of library", cards, manipulable, topOK, bottomOK, false); CardCollection toBottom = new CardCollection(); CardCollection toTop = new CardCollection(); @@ -778,10 +765,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont tempShowCards(topN); if ( FModel.getPreferences().getPrefBoolean(FPref.UI_SELECT_FROM_CARD_DISPLAYS) && (!GuiBase.getInterface().isLibgdxPort()) ) { - ArrayList cardList = new ArrayList(); // pfps there must be a better way - for (final Card card : player.getCardsIn(ZoneType.Library)) { - cardList.add(card); - } + CardCollectionView cardList = player.getCardsIn(ZoneType.Library); ImmutablePair result = arrangeForMove("Move cards to top or bottom of library", cardList, topN, true, true); toTop = result.getLeft();