CardDb recieves editions in special order, and adds newest editions first. Thus the values of MapOfLists<String, PaperCard> allCardsByName are arranged - newest prints come first

This commit is contained in:
Maxmtg
2013-06-05 20:09:12 +00:00
parent f05d8e9b80
commit dd615480a1
2 changed files with 12 additions and 1 deletions

View File

@@ -18,10 +18,13 @@
package forge.card;
import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import forge.util.IItemReader;
import forge.util.storage.StorageView;
@@ -55,6 +58,14 @@ public final class EditionCollection extends StorageView<CardEdition> {
return baseResult == null ? aliasToEdition.get(code) : baseResult;
}
public Iterable<CardEdition> getOrderedEditions() {
List<CardEdition> res = Lists.newArrayList(this);
Collections.sort(res);
Collections.reverse(res);
return res;
}
/**
* Gets the sets by code or throw.
*

View File

@@ -146,7 +146,7 @@ public enum FModel {
FThreads.assertExecutedByEdt(false);
final CardStorageReader reader = new CardStorageReader(NewConstants.CARD_DATA_DIR, true);
// this fills in our map of card names to Card instances.
CardDb.setup(reader.loadCards(), editions);
CardDb.setup(reader.loadCards(), editions.getOrderedEditions());
this.formats = new FormatCollection("res/blockdata/formats.txt");