Fix more places to load cards lazily correctly.

This commit is contained in:
Myrd
2016-11-06 18:22:04 +00:00
parent 300895343b
commit b175963878
4 changed files with 25 additions and 18 deletions

View File

@@ -185,19 +185,11 @@ public class GauntletIO {
final String sIndex = reader.getAttribute("i");
final short index = StringUtils.isNumeric(sIndex) ? Short.parseShort(sIndex) : 0;
final boolean foil = "1".equals(reader.getAttribute("foil"));
PaperCard card = FModel.getMagicDb().getCommonCards().getCard(name, set, index);
if (null == card) {
FModel.getMagicDb().attemptToLoadCard(name, set);
card = FModel.getMagicDb().getCommonCards().getCard(name, set, index);
}
if (null == card) {
FModel.getMagicDb().attemptToLoadCard(name, set);
card = FModel.getMagicDb().getCommonCards().getCard(name, set, -1);
}
PaperCard card = FModel.getMagicDb().getOrLoadCommonCard(name, set, index, foil);
if (null == card) {
throw new RuntimeException("Unsupported card found in quest save: " + name + " from edition " + set);
}
return foil ? FModel.getMagicDb().getCommonCards().getFoiled(card) : card;
return card;
}
}
}

View File

@@ -897,9 +897,11 @@ public class QuestDataIO {
final String sIndex = reader.getAttribute("i");
final short index = StringUtils.isNumeric(sIndex) ? Short.parseShort(sIndex) : 0;
final boolean foil = "1".equals(reader.getAttribute("foil"));
PaperCard c = FModel.getMagicDb().getCommonCards().getCard(name, set, index);
if ( null == c ) c = FModel.getMagicDb().getCommonCards().getCard(name);
return foil ? FModel.getMagicDb().getCommonCards().getFoiled(c) : c;
PaperCard card = FModel.getMagicDb().getOrLoadCommonCard(name, set, index, foil);
if (null == card) {
throw new RuntimeException("Unsupported card found in quest save: " + name + " from edition " + set);
}
return card;
}
}
}

View File

@@ -177,14 +177,11 @@ public class TournamentIO {
final String sIndex = reader.getAttribute("i");
final short index = StringUtils.isNumeric(sIndex) ? Short.parseShort(sIndex) : 0;
final boolean foil = "1".equals(reader.getAttribute("foil"));
PaperCard card = FModel.getMagicDb().getCommonCards().getCard(name, set, index);
if (null == card) {
card = FModel.getMagicDb().getCommonCards().getCard(name, set, -1);
}
PaperCard card = FModel.getMagicDb().getOrLoadCommonCard(name, set, index, foil);
if (null == card) {
throw new RuntimeException("Unsupported card found in quest save: " + name + " from edition " + set);
}
return foil ? FModel.getMagicDb().getCommonCards().getFoiled(card) : card;
return card;
}
}
}