mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
edition cached in deckproxy
This commit is contained in:
@@ -48,6 +48,7 @@ public class DeckProxy implements InventoryItem {
|
|||||||
private int sbSize = Integer.MIN_VALUE;
|
private int sbSize = Integer.MIN_VALUE;
|
||||||
private final String path;
|
private final String path;
|
||||||
private final Function<IHasName, Deck> fnGetDeck;
|
private final Function<IHasName, Deck> fnGetDeck;
|
||||||
|
private String edition;
|
||||||
|
|
||||||
public DeckProxy(Deck deck, GameType type, IStorage<? extends IHasName> storage) {
|
public DeckProxy(Deck deck, GameType type, IStorage<? extends IHasName> storage) {
|
||||||
this(deck, type, "", storage, null);
|
this(deck, type, "", storage, null);
|
||||||
@@ -85,12 +86,13 @@ public class DeckProxy implements InventoryItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getEdition() {
|
public String getEdition() {
|
||||||
if ( deck instanceof PreconDeck )
|
if ( null == edition ) {
|
||||||
return ((PreconDeck) deck).getEdition();
|
if ( deck instanceof PreconDeck )
|
||||||
Deck d = getDeck();
|
edition = ((PreconDeck) deck).getEdition();
|
||||||
if ( d != null )
|
if ( !isGeneratedDeck() )
|
||||||
return StaticData.instance().getEditions().getEarliestEditionWithAllCards(d.getAllCardsInASinglePool()).getCode();
|
edition = StaticData.instance().getEditions().getEarliestEditionWithAllCards(getDeck().getAllCardsInASinglePool()).getCode();
|
||||||
return null;
|
}
|
||||||
|
return edition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -101,6 +103,7 @@ public class DeckProxy implements InventoryItem {
|
|||||||
public void invalidateCache() {
|
public void invalidateCache() {
|
||||||
color = null;
|
color = null;
|
||||||
formats = null;
|
formats = null;
|
||||||
|
edition = null;
|
||||||
mainSize = Integer.MIN_VALUE;
|
mainSize = Integer.MIN_VALUE;
|
||||||
sbSize = Integer.MIN_VALUE;
|
sbSize = Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user