mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Won't show errors if a card has no setinfo.
This commit is contained in:
@@ -39,8 +39,6 @@ public final class CardDb {
|
||||
}
|
||||
}
|
||||
}
|
||||
private static List<String> skippedCards = new ArrayList<String>();
|
||||
public static List<String> getSkippedCards() { return skippedCards; }
|
||||
|
||||
// Here oracle cards
|
||||
private final Map<String, CardRules> cards = new Hashtable<String, CardRules>();
|
||||
@@ -63,17 +61,13 @@ public final class CardDb {
|
||||
|
||||
private CardDb(final Iterator<CardRules> parser) {
|
||||
while (parser.hasNext()) {
|
||||
CardRules nextCard = parser.next();
|
||||
boolean wasAdded = addNewCard(nextCard);
|
||||
if (!wasAdded) {
|
||||
skippedCards.add(nextCard.getName());
|
||||
}
|
||||
addNewCard(parser.next());
|
||||
}
|
||||
// TODO: consider using Collections.unmodifiableList wherever possible
|
||||
}
|
||||
|
||||
public boolean addNewCard(final CardRules card) {
|
||||
if (null == card) { return true; } // consider that a success
|
||||
public void addNewCard(final CardRules card) {
|
||||
if (null == card) { return; } // consider that a success
|
||||
//System.out.println(card.getName());
|
||||
String cardName = card.getName().toLowerCase();
|
||||
|
||||
@@ -101,12 +95,7 @@ public final class CardDb {
|
||||
cardCopies[i] = lastAdded;
|
||||
}
|
||||
}
|
||||
|
||||
if (null != lastAdded) {
|
||||
uniqueCards.put(cardName, lastAdded);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
uniqueCards.put(cardName, lastAdded);
|
||||
}
|
||||
|
||||
// Single fetch
|
||||
|
||||
@@ -13,7 +13,8 @@ public enum CardRarity {
|
||||
Uncommon("U"),
|
||||
Rare("R"),
|
||||
MythicRare("M"),
|
||||
Special("S"); // Timeshifted
|
||||
Special("S"), // Timeshifted
|
||||
Unknown("?"); // In development
|
||||
|
||||
private final String strValue;
|
||||
private CardRarity(final String sValue) {
|
||||
|
||||
@@ -86,6 +86,10 @@ public final class CardRules {
|
||||
} else if (cardType.isPlaneswalker()) {
|
||||
this.loyalty = ptLine;
|
||||
}
|
||||
|
||||
if (setsData.isEmpty()) {
|
||||
setsData.put("???", new CardInSet(CardRarity.Unknown, 1));
|
||||
}
|
||||
setsPrinted = setsData;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,12 +81,7 @@ public class PreloadingCardFactory extends AbstractCardFactory {
|
||||
// this fills in our map of card names to Card instances.
|
||||
read.run();
|
||||
CardDb.setup(listCardRules.iterator());
|
||||
|
||||
List<String> skipped = CardDb.getSkippedCards();
|
||||
if (!skipped.isEmpty()) {
|
||||
String message = String.format("The following cards are lacking of correct SetInfo: %s", StringUtils.join(skipped, ", "));
|
||||
ErrorViewer.showError(message);
|
||||
}
|
||||
|
||||
} // readCard()
|
||||
|
||||
} //end class PreloadingCardFactory
|
||||
|
||||
Reference in New Issue
Block a user