deckmanager is now forced to store cards along with sets they belong to, cause ppl want customized decks

This commit is contained in:
Maxmtg
2011-09-06 00:22:48 +00:00
parent a4d4b6b1d8
commit 153310af5d

View File

@@ -375,13 +375,13 @@ public class DeckManager {
// Precondition: iterator should point at the first line of cards list // Precondition: iterator should point at the first line of cards list
private static List<String> readCardList(final ListIterator<String> lineIterator) { private static List<String> readCardList(final ListIterator<String> lineIterator) {
List<String> result = new ArrayList<String>(); List<String> result = new ArrayList<String>();
Pattern p = Pattern.compile("\\s*((\\d+)\\s+)?(.*?)\\s*"); Pattern p = Pattern.compile("((\\d+)\\s+)?(.*?)");
while (lineIterator.hasNext()) { while (lineIterator.hasNext()) {
String line = lineIterator.next(); String line = lineIterator.next();
if (line.startsWith("[")) { break; } // there comes another section if (line.startsWith("[")) { break; } // there comes another section
Matcher m = p.matcher(line); Matcher m = p.matcher(line.trim());
m.matches(); m.matches();
String sCnt = m.group(2); String sCnt = m.group(2);
String cardName = m.group(3); String cardName = m.group(3);
@@ -474,11 +474,11 @@ public class DeckManager {
out.write(format("%s%n", "[main]")); out.write(format("%s%n", "[main]"));
for (Entry<CardPrinted, Integer> e : d.getMain()) { for (Entry<CardPrinted, Integer> e : d.getMain()) {
out.write(format("%d %s%n", e.getValue(), e.getKey().getName())); out.write(format("%d %s|%s%n", e.getValue(), e.getKey().getName(), e.getKey().getSet()));
} }
out.write(format("%s%n", "[sideboard]")); out.write(format("%s%n", "[sideboard]"));
for (Entry<CardPrinted, Integer> e : d.getSideboard()) { for (Entry<CardPrinted, Integer> e : d.getSideboard()) {
out.write(format("%d %s%n", e.getValue(), e.getKey().getName())); out.write(format("%d %s|%s%n", e.getValue(), e.getKey().getName(), e.getKey().getSet()));
} }
} }