mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Avoid errors due to loading cards for card-based deck generation when lazy loading is enabled (for now just disables card-based deck generation completely) - does not handle cases where card-based decks are currently selected in constructed, then the lazy loading is switched on, then forge restarted.
This commit is contained in:
@@ -5,6 +5,8 @@ import forge.deckchooser.FDeckChooser;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
import forge.gui.framework.EDocID;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.screens.home.EMenuGroup;
|
||||
import forge.screens.home.IVSubmenu;
|
||||
import forge.screens.home.StartButton;
|
||||
@@ -83,7 +85,13 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
||||
boxThemeDecks.setSelected(true);
|
||||
boxColorDecks.setSelected(true);
|
||||
boxStandardColorDecks.setSelected(true);
|
||||
boxStandardCardgenDecks.setSelected(true);
|
||||
if(!FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_CARD_SCRIPTS_LAZILY)) {
|
||||
boxStandardCardgenDecks.setSelected(true);
|
||||
boxModernCardgenDecks.setSelected(true);
|
||||
}else{
|
||||
boxStandardCardgenDecks.setSelected(false);
|
||||
boxModernCardgenDecks.setSelected(false);
|
||||
}
|
||||
boxModernColorDecks.setSelected(true);
|
||||
|
||||
sliOpponents.setMajorTickSpacing(5);
|
||||
@@ -106,9 +114,11 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
||||
pnlOptions.add(boxQuestDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(boxThemeDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(boxColorDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
if(!FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_CARD_SCRIPTS_LAZILY)) {
|
||||
pnlOptions.add(boxStandardCardgenDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(boxModernCardgenDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
}
|
||||
pnlOptions.add(boxStandardColorDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(boxStandardCardgenDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(boxModernCardgenDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(boxModernColorDecks, "w 96%!, h 30px!, gap 2% 0 0 0");
|
||||
}
|
||||
|
||||
|
||||
@@ -440,8 +440,10 @@ public class FDeckChooser extends FScreen {
|
||||
cmbDeckTypes.addItem(DeckType.QUEST_OPPONENT_DECK);
|
||||
cmbDeckTypes.addItem(DeckType.COLOR_DECK);
|
||||
cmbDeckTypes.addItem(DeckType.STANDARD_COLOR_DECK);
|
||||
cmbDeckTypes.addItem(DeckType.STANDARD_CARDGEN_DECK);
|
||||
cmbDeckTypes.addItem(DeckType.MODERN_CARDGEN_DECK);
|
||||
if(!FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_CARD_SCRIPTS_LAZILY)) {
|
||||
cmbDeckTypes.addItem(DeckType.STANDARD_CARDGEN_DECK);
|
||||
cmbDeckTypes.addItem(DeckType.MODERN_CARDGEN_DECK);
|
||||
}
|
||||
cmbDeckTypes.addItem(DeckType.MODERN_COLOR_DECK);
|
||||
cmbDeckTypes.addItem(DeckType.THEME_DECK);
|
||||
cmbDeckTypes.addItem(DeckType.RANDOM_DECK);
|
||||
@@ -937,19 +939,32 @@ public class FDeckChooser extends FScreen {
|
||||
@Override
|
||||
public void run(final Integer numOpponents) {
|
||||
if (numOpponents == null) { return; }
|
||||
|
||||
List<DeckType> deckTypes=null;
|
||||
if(!FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_CARD_SCRIPTS_LAZILY)) {
|
||||
deckTypes=Arrays.asList(new DeckType[] {
|
||||
DeckType.CUSTOM_DECK,
|
||||
DeckType.PRECONSTRUCTED_DECK,
|
||||
DeckType.QUEST_OPPONENT_DECK,
|
||||
DeckType.COLOR_DECK,
|
||||
DeckType.STANDARD_COLOR_DECK,
|
||||
DeckType.STANDARD_CARDGEN_DECK,
|
||||
DeckType.MODERN_COLOR_DECK,
|
||||
DeckType.MODERN_CARDGEN_DECK,
|
||||
DeckType.THEME_DECK
|
||||
});
|
||||
}else{
|
||||
deckTypes=Arrays.asList(new DeckType[] {
|
||||
DeckType.CUSTOM_DECK,
|
||||
DeckType.PRECONSTRUCTED_DECK,
|
||||
DeckType.QUEST_OPPONENT_DECK,
|
||||
DeckType.COLOR_DECK,
|
||||
DeckType.STANDARD_COLOR_DECK,
|
||||
DeckType.MODERN_COLOR_DECK,
|
||||
DeckType.THEME_DECK
|
||||
});
|
||||
}
|
||||
ListChooser<DeckType> chooser = new ListChooser<DeckType>(
|
||||
"Choose allowed deck types for opponents", 0, 7, Arrays.asList(new DeckType[] {
|
||||
DeckType.CUSTOM_DECK,
|
||||
DeckType.PRECONSTRUCTED_DECK,
|
||||
DeckType.QUEST_OPPONENT_DECK,
|
||||
DeckType.COLOR_DECK,
|
||||
DeckType.STANDARD_COLOR_DECK,
|
||||
DeckType.STANDARD_CARDGEN_DECK,
|
||||
DeckType.MODERN_COLOR_DECK,
|
||||
DeckType.MODERN_CARDGEN_DECK,
|
||||
DeckType.THEME_DECK
|
||||
}), null, new Callback<List<DeckType>>() {
|
||||
"Choose allowed deck types for opponents", 0, 7, deckTypes, null, new Callback<List<DeckType>>() {
|
||||
@Override
|
||||
public void run(final List<DeckType> allowedDeckTypes) {
|
||||
if (allowedDeckTypes == null || allowedDeckTypes.isEmpty()) { return; }
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package forge.deck;
|
||||
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences;
|
||||
|
||||
public enum DeckType {
|
||||
CUSTOM_DECK ("Custom User Decks"),
|
||||
CONSTRUCTED_DECK ("Constructed Decks"),
|
||||
@@ -21,19 +24,37 @@ public enum DeckType {
|
||||
NET_DECK ("Net Decks"),
|
||||
NET_COMMANDER_DECK ("Net Commander Decks");
|
||||
|
||||
public static final DeckType[] ConstructedOptions = new DeckType[] {
|
||||
DeckType.CUSTOM_DECK,
|
||||
DeckType.PRECONSTRUCTED_DECK,
|
||||
DeckType.QUEST_OPPONENT_DECK,
|
||||
DeckType.COLOR_DECK,
|
||||
DeckType.STANDARD_COLOR_DECK,
|
||||
DeckType.STANDARD_CARDGEN_DECK,
|
||||
DeckType.MODERN_CARDGEN_DECK,
|
||||
DeckType.MODERN_COLOR_DECK,
|
||||
DeckType.THEME_DECK,
|
||||
DeckType.RANDOM_DECK,
|
||||
DeckType.NET_DECK
|
||||
};
|
||||
public static DeckType[] ConstructedOptions;
|
||||
|
||||
static {
|
||||
if (!FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.LOAD_CARD_SCRIPTS_LAZILY)) {
|
||||
ConstructedOptions = new DeckType[]{
|
||||
DeckType.CUSTOM_DECK,
|
||||
DeckType.PRECONSTRUCTED_DECK,
|
||||
DeckType.QUEST_OPPONENT_DECK,
|
||||
DeckType.COLOR_DECK,
|
||||
DeckType.STANDARD_COLOR_DECK,
|
||||
DeckType.STANDARD_CARDGEN_DECK,
|
||||
DeckType.MODERN_CARDGEN_DECK,
|
||||
DeckType.MODERN_COLOR_DECK,
|
||||
DeckType.THEME_DECK,
|
||||
DeckType.RANDOM_DECK,
|
||||
DeckType.NET_DECK
|
||||
};
|
||||
} else {
|
||||
ConstructedOptions = new DeckType[]{
|
||||
DeckType.CUSTOM_DECK,
|
||||
DeckType.PRECONSTRUCTED_DECK,
|
||||
DeckType.QUEST_OPPONENT_DECK,
|
||||
DeckType.COLOR_DECK,
|
||||
DeckType.STANDARD_COLOR_DECK,
|
||||
DeckType.MODERN_COLOR_DECK,
|
||||
DeckType.THEME_DECK,
|
||||
DeckType.RANDOM_DECK,
|
||||
DeckType.NET_DECK
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private String value;
|
||||
private DeckType(final String value) {
|
||||
|
||||
@@ -214,7 +214,9 @@ public final class FModel {
|
||||
AiProfileUtil.loadAllProfiles(ForgeConstants.AI_PROFILE_DIR);
|
||||
|
||||
//generate Deck Gen matrix
|
||||
CardRelationMatrixGenerator.initialize();
|
||||
if(!FModel.getPreferences().getPrefBoolean(FPref.LOAD_CARD_SCRIPTS_LAZILY)) {
|
||||
CardRelationMatrixGenerator.initialize();
|
||||
}
|
||||
}
|
||||
|
||||
public static QuestController getQuest() {
|
||||
|
||||
Reference in New Issue
Block a user