mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
*Converted QuestWinLose.awardBooster() from raw ListChooser access to GuiChoose methods. (Fixes end of Quest games crash)
This commit is contained in:
@@ -88,15 +88,19 @@ public class GuiChoose {
|
||||
}
|
||||
|
||||
public static <T> List<T> noneOrMany(final String message, final Collection<T> 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 <T> List<T> 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 <T> List<T> getChoices(final String message, final int min, final int max, final Collection<T> choices) {
|
||||
return getChoices(message, min, max, choices, null);
|
||||
}
|
||||
|
||||
public static <T> List<T> getChoices(final String message, final int min, final int max, final Collection<T> choices) {
|
||||
public static <T> List<T> getChoices(final String message, final int min, final int max, final Collection<T> choices,final T selected) {
|
||||
if (null == choices || choices.isEmpty()) {
|
||||
if (0 == min) {
|
||||
return new ArrayList<T>();
|
||||
@@ -124,7 +128,12 @@ public class GuiChoose {
|
||||
}
|
||||
}
|
||||
});
|
||||
c.show();
|
||||
|
||||
if(selected != null)
|
||||
c.show(selected);
|
||||
else
|
||||
c.show();
|
||||
|
||||
GuiUtils.clearPanelSelections();
|
||||
return c.getSelectedValues();
|
||||
}
|
||||
|
||||
@@ -560,10 +560,8 @@ public class QuestWinLose extends ControlWinLose {
|
||||
}
|
||||
|
||||
Collections.sort(formats);
|
||||
final ListChooser<GameFormat> ch = new ListChooser<GameFormat>("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());
|
||||
|
||||
Reference in New Issue
Block a user