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:
austinio7116
2017-06-29 07:46:13 +00:00
parent 246542bdad
commit ba71e6a7e3
4 changed files with 79 additions and 31 deletions

View File

@@ -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) {

View File

@@ -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() {