mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Added optional customformats.txt file (to be put in the user preferences folder) to append formats to the regular list so that custom formats can be retained between upgrades
This commit is contained in:
@@ -280,6 +280,11 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(GameFormat item) {
|
||||
naturallyOrdered.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public final Predicate<CardEdition> editionLegalPredicate = new Predicate<CardEdition>() {
|
||||
|
||||
@@ -93,6 +93,8 @@ public final class FModel {
|
||||
private static IStorage<QuestWorld> worlds;
|
||||
private static GameFormat.Collection formats;
|
||||
|
||||
private static GameFormat.Collection customFormats;
|
||||
|
||||
public static void initialize(final IProgressBar progressBar, Function<ForgePreferences, Void> adjustPrefs) {
|
||||
ImageKeys.initializeDirs(
|
||||
ForgeConstants.CACHE_CARD_PICS_DIR, ForgeConstants.CACHE_CARD_PICS_SUBDIR,
|
||||
@@ -162,6 +164,12 @@ public final class FModel {
|
||||
ForgePreferences.UPLOAD_DRAFT = ForgePreferences.NET_CONN;
|
||||
|
||||
formats = new GameFormat.Collection(new GameFormat.Reader(new File(ForgeConstants.BLOCK_DATA_DIR + "formats.txt")));
|
||||
//add user custom formats if file present
|
||||
customFormats = new GameFormat.Collection(new GameFormat.Reader(new File(ForgeConstants.USER_PREFS_DIR + "customformats.txt")));
|
||||
for (GameFormat format:customFormats){
|
||||
formats.add(format);
|
||||
}
|
||||
|
||||
blocks = new StorageBase<>("Block definitions", new CardBlock.Reader(ForgeConstants.BLOCK_DATA_DIR + "blocks.txt", magicDb.getEditions()));
|
||||
questPreferences = new QuestPreferences();
|
||||
conquestPreferences = new ConquestPreferences();
|
||||
|
||||
Reference in New Issue
Block a user