From 2c438afdb450f17fb7897b9e5a8ce1ccf70e70a6 Mon Sep 17 00:00:00 2001 From: Hellfish Date: Sat, 6 Apr 2013 07:21:06 +0000 Subject: [PATCH] *Converted QuestWinLose.awardBooster() from raw ListChooser access to GuiChoose methods. (Fixes end of Quest games crash) --- src/main/java/forge/gui/GuiChoose.java | 17 +++++++++++++---- src/main/java/forge/gui/match/QuestWinLose.java | 4 +--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/forge/gui/GuiChoose.java b/src/main/java/forge/gui/GuiChoose.java index 8b699aa0b14..3f80320685a 100644 --- a/src/main/java/forge/gui/GuiChoose.java +++ b/src/main/java/forge/gui/GuiChoose.java @@ -88,15 +88,19 @@ public class GuiChoose { } public static List noneOrMany(final String message, final Collection choices) { - return GuiChoose.getChoices(message, 0, choices.size(), choices); + return GuiChoose.getChoices(message, 0, choices.size(), choices, null); } // returned Object will never be null public static List getChoices(final String message, final int min, final int max, final T[] choices) { - return getChoices(message, min, max, Arrays.asList(choices)); + return getChoices(message, min, max, Arrays.asList(choices), null); + } + + public static List getChoices(final String message, final int min, final int max, final Collection choices) { + return getChoices(message, min, max, choices, null); } - public static List getChoices(final String message, final int min, final int max, final Collection choices) { + public static List getChoices(final String message, final int min, final int max, final Collection choices,final T selected) { if (null == choices || choices.isEmpty()) { if (0 == min) { return new ArrayList(); @@ -124,7 +128,12 @@ public class GuiChoose { } } }); - c.show(); + + if(selected != null) + c.show(selected); + else + c.show(); + GuiUtils.clearPanelSelections(); return c.getSelectedValues(); } diff --git a/src/main/java/forge/gui/match/QuestWinLose.java b/src/main/java/forge/gui/match/QuestWinLose.java index 06a740398be..d2d37338f58 100644 --- a/src/main/java/forge/gui/match/QuestWinLose.java +++ b/src/main/java/forge/gui/match/QuestWinLose.java @@ -560,10 +560,8 @@ public class QuestWinLose extends ControlWinLose { } Collections.sort(formats); - final ListChooser ch = new ListChooser("Choose bonus booster format", 1, 1, formats); - ch.show(pref); - final GameFormat selected = ch.getSelectedValue(); + final GameFormat selected = GuiChoose.getChoices("Choose bonus booster format", 1, 1, formats, pref).get(0); //ch.getSelectedValue(); Singletons.getModel().getQuestPreferences().setPref(QPref.BOOSTER_FORMAT, selected.toString()); cardsWon = qData.getCards().addCards(selected.getFilterPrinted());