merge latest trunk

This commit is contained in:
myk
2013-03-10 21:56:06 +00:00
4 changed files with 23 additions and 7 deletions

View File

@@ -63,6 +63,8 @@ import forge.model.BuildInfo;
* @version V1.0 02.08.2009
*/
public class BugReporter {
private static final int _STACK_OVERFLOW_MAX_MESSAGE_LEN = 16 * 1024;
/**
* Shows exception information in a format ready to post to the forum as a crash report. Uses the exception's message
* as the reason if message is null.
@@ -88,7 +90,17 @@ public class BugReporter {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
sb.append(sw.toString());
String swStr = sw.toString();
if (ex instanceof StackOverflowError &&
_STACK_OVERFLOW_MAX_MESSAGE_LEN <= swStr.length()) {
// most likely a cycle. only take first portion so the message
// doesn't grow too large to post
sb.append(swStr, 0, _STACK_OVERFLOW_MAX_MESSAGE_LEN);
sb.append("\n... (truncated)");
} else {
sb.append(swStr);
}
_buildSpoilerFooter(sb);

View File

@@ -151,8 +151,10 @@ public class GameNew {
if (rAICards.size() > 0) {
String message = buildFourColumnList("AI deck contains the following cards that it can't play or may be buggy:", rAICards);
if (GameType.Quest == game.getType()) {
// log, but do not visually warn. quest decks are supposedly already vetted by the quest creator
if (GameType.Quest == game.getType() || GameType.Sealed == game.getType() || GameType.Draft == game.getType()) {
// log, but do not visually warn. quest decks are supposedly already vetted by the quest creator,
// sealed and draft decks do not get any AI-unplayable picks but may contain several
// received/picked but unplayable cards in the sideboard.
System.err.println(message);
} else {
JOptionPane.showMessageDialog(null, message, "", JOptionPane.INFORMATION_MESSAGE);

View File

@@ -145,7 +145,8 @@ public class PlayerControllerHuman extends PlayerController {
JOptionPane.showMessageDialog(null, errMsg, "Invalid deck", JOptionPane.ERROR_MESSAGE);
}
newMain = GuiChoose.sideboard(sideboard.toFlatList(), main.toFlatList());
boolean isLimited = (gameType == GameType.Draft || gameType == GameType.Sealed);
newMain = GuiChoose.sideboard(sideboard.toFlatList(), main.toFlatList(), isLimited);
}
newSb.clear();

View File

@@ -149,10 +149,10 @@ public class GuiChoose {
return order(title, top, remainingObjects, sourceChoices, destChoices, referenceCard, false);
}
public static <T extends Comparable<? super T>> List<T> sideboard(List<T> sideboard, List<T> deck) {
public static <T extends Comparable<? super T>> List<T> sideboard(List<T> sideboard, List<T> deck, boolean isLimitedMode) {
Collections.sort(deck);
Collections.sort(sideboard);
return order("Sideboard", "Main Deck", sideboard.size(), sideboard, deck, null, true);
return order("Sideboard", "Main Deck", isLimitedMode ? -1 : sideboard.size(), sideboard, deck, null, true);
}
@@ -161,7 +161,6 @@ public class GuiChoose {
// An input box for handling the order of choices.
final JFrame frame = new JFrame();
DualListBox<T> dual = new DualListBox<T>(remainingObjects, sourceChoices, destChoices);
dual.setSideboardMode(sideboardingMode);
dual.setSecondColumnLabelText(top);
frame.setLayout(new BorderLayout());
@@ -170,6 +169,8 @@ public class GuiChoose {
frame.setTitle(title);
frame.setVisible(false);
dual.setSideboardMode(sideboardingMode);
final JDialog dialog = new JDialog(frame, true);
dialog.setTitle(title);
dialog.setContentPane(dual);