mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +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) {
|
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
|
// returned Object will never be null
|
||||||
public static <T> List<T> getChoices(final String message, final int min, final int max, final T[] choices) {
|
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) {
|
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,final T selected) {
|
||||||
if (null == choices || choices.isEmpty()) {
|
if (null == choices || choices.isEmpty()) {
|
||||||
if (0 == min) {
|
if (0 == min) {
|
||||||
return new ArrayList<T>();
|
return new ArrayList<T>();
|
||||||
@@ -124,7 +128,12 @@ public class GuiChoose {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(selected != null)
|
||||||
|
c.show(selected);
|
||||||
|
else
|
||||||
c.show();
|
c.show();
|
||||||
|
|
||||||
GuiUtils.clearPanelSelections();
|
GuiUtils.clearPanelSelections();
|
||||||
return c.getSelectedValues();
|
return c.getSelectedValues();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,10 +560,8 @@ public class QuestWinLose extends ControlWinLose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(formats);
|
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());
|
Singletons.getModel().getQuestPreferences().setPref(QPref.BOOSTER_FORMAT, selected.toString());
|
||||||
|
|
||||||
cardsWon = qData.getCards().addCards(selected.getFilterPrinted());
|
cardsWon = qData.getCards().addCards(selected.getFilterPrinted());
|
||||||
|
|||||||
Reference in New Issue
Block a user