diff --git a/forge-core/src/main/java/forge/deck/Deck.java b/forge-core/src/main/java/forge/deck/Deck.java index 7fae7265105..65e48cf585f 100644 --- a/forge-core/src/main/java/forge/deck/Deck.java +++ b/forge-core/src/main/java/forge/deck/Deck.java @@ -44,14 +44,11 @@ public class Deck extends DeckBase implements Iterable tags = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); // Supports deferring loading a deck until we actually need its contents. This works in conjunction with // the lazy card load feature to ensure we don't need to load all cards on start up. - private Map> deferredSections; + private Map> deferredSections = null; + private Map> loadedSections = null; + private String latestCardArtPreferenceUsed = ""; + private boolean includeCardsFromUnspecifiedSet = false; - // gameType is from Constant.GameType, like GameType.Regular - /** - *

- * Decks have their named finalled. - *

- */ public Deck() { this(""); } @@ -217,17 +214,32 @@ public class Deck extends DeckBase implements Iterable> referenceDeckLoadingMap; + if (deferredSections != null) + referenceDeckLoadingMap = new HashMap<>(deferredSections); + else + referenceDeckLoadingMap = new HashMap<>(loadedSections); + + loadedSections = new HashMap<>(); + latestCardArtPreferenceUsed = cardArtPreference; boolean smartCardArtSelection = StaticData.instance().smartCardArtSelectionIsEnabled(); - boolean foundCardsWithUnspecifiedEditions = false; Map> cardsWithNoEdition = null; if (smartCardArtSelection) cardsWithNoEdition = new EnumMap<>(DeckSection.class); - for (Entry> s : deferredSections.entrySet()) { + for (Entry> s : referenceDeckLoadingMap.entrySet()) { + // first thing, update loaded section + loadedSections.put(s.getKey(), s.getValue()); DeckSection sec = DeckSection.smartValueOf(s.getKey()); if (sec == null) continue; @@ -235,7 +247,7 @@ public class Deck extends DeckBase implements Iterable cardNamesWithNoEdition = getAllCardNamesWithNoSpecifiedEdition(cardsInSection); if (cardNamesWithNoEdition.size() > 0){ - foundCardsWithUnspecifiedEditions = true; + includeCardsFromUnspecifiedSet = true; cardsWithNoEdition.put(sec, cardNamesWithNoEdition); } } @@ -251,9 +263,8 @@ public class Deck extends DeckBase implements Iterable