From 2f29cf7755440886731fce12b8bd0e6ee45bfaab Mon Sep 17 00:00:00 2001 From: Maxmtg Date: Sat, 25 Jan 2014 15:50:56 +0000 Subject: [PATCH] edition cached in deckproxy --- .../main/java/forge/gui/deckeditor/DeckProxy.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/forge-gui/src/main/java/forge/gui/deckeditor/DeckProxy.java b/forge-gui/src/main/java/forge/gui/deckeditor/DeckProxy.java index 1ab10f4f358..5cee4464727 100644 --- a/forge-gui/src/main/java/forge/gui/deckeditor/DeckProxy.java +++ b/forge-gui/src/main/java/forge/gui/deckeditor/DeckProxy.java @@ -48,6 +48,7 @@ public class DeckProxy implements InventoryItem { private int sbSize = Integer.MIN_VALUE; private final String path; private final Function fnGetDeck; + private String edition; public DeckProxy(Deck deck, GameType type, IStorage storage) { this(deck, type, "", storage, null); @@ -85,12 +86,13 @@ public class DeckProxy implements InventoryItem { } public String getEdition() { - if ( deck instanceof PreconDeck ) - return ((PreconDeck) deck).getEdition(); - Deck d = getDeck(); - if ( d != null ) - return StaticData.instance().getEditions().getEarliestEditionWithAllCards(d.getAllCardsInASinglePool()).getCode(); - return null; + if ( null == edition ) { + if ( deck instanceof PreconDeck ) + edition = ((PreconDeck) deck).getEdition(); + if ( !isGeneratedDeck() ) + edition = StaticData.instance().getEditions().getEarliestEditionWithAllCards(getDeck().getAllCardsInASinglePool()).getCode(); + } + return edition; } @Override @@ -101,6 +103,7 @@ public class DeckProxy implements InventoryItem { public void invalidateCache() { color = null; formats = null; + edition = null; mainSize = Integer.MIN_VALUE; sbSize = Integer.MIN_VALUE; }