- Do not crash when an unsupported card is found in a quest save, instead warn about it in the log and do not include the card in the pool (which eventually removes it from the save file).

- Might need to do something about CNS Conspiracies and other substandard cards enering the quest pool (e.g. from reward booster packs), which tended to "corrupt" the quest save by introducing cards into the pool which can't be loaded later (and used to crash).
This commit is contained in:
Agetian
2016-12-27 19:09:32 +00:00
parent e707613ff0
commit a2cca4cb5a

View File

@@ -733,7 +733,10 @@ public class QuestDataIO {
if ("string".equals(nodename)) { if ("string".equals(nodename)) {
pool.add(FModel.getMagicDb().getCommonCards().getCard(reader.getValue())); pool.add(FModel.getMagicDb().getCommonCards().getCard(reader.getValue()));
} else if ("card".equals(nodename)) { // new format } else if ("card".equals(nodename)) { // new format
pool.add(this.readCardPrinted(reader), cnt); PaperCard pc = this.readCardPrinted(reader);
if (pc != null) {
pool.add(pc, cnt);
}
} }
reader.moveUp(); reader.moveUp();
} }
@@ -899,7 +902,7 @@ public class QuestDataIO {
final boolean foil = "1".equals(reader.getAttribute("foil")); final boolean foil = "1".equals(reader.getAttribute("foil"));
PaperCard card = FModel.getMagicDb().getOrLoadCommonCard(name, set, index, foil); PaperCard card = FModel.getMagicDb().getOrLoadCommonCard(name, set, index, foil);
if (null == card) { if (null == card) {
throw new RuntimeException("Unsupported card found in quest save: " + name + " from edition " + set); System.err.println("Warning: Unsupported card found in quest save: " + name + " from edition " + set +". It will be removed from the quest save.");
} }
return card; return card;
} }