mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
merge latest trunk
This commit is contained in:
@@ -63,6 +63,8 @@ import forge.model.BuildInfo;
|
|||||||
* @version V1.0 02.08.2009
|
* @version V1.0 02.08.2009
|
||||||
*/
|
*/
|
||||||
public class BugReporter {
|
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
|
* 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.
|
* as the reason if message is null.
|
||||||
@@ -88,7 +90,17 @@ public class BugReporter {
|
|||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
PrintWriter pw = new PrintWriter(sw);
|
PrintWriter pw = new PrintWriter(sw);
|
||||||
ex.printStackTrace(pw);
|
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);
|
_buildSpoilerFooter(sb);
|
||||||
|
|
||||||
|
|||||||
@@ -151,8 +151,10 @@ public class GameNew {
|
|||||||
|
|
||||||
if (rAICards.size() > 0) {
|
if (rAICards.size() > 0) {
|
||||||
String message = buildFourColumnList("AI deck contains the following cards that it can't play or may be buggy:", rAICards);
|
String message = buildFourColumnList("AI deck contains the following cards that it can't play or may be buggy:", rAICards);
|
||||||
if (GameType.Quest == game.getType()) {
|
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
|
// 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);
|
System.err.println(message);
|
||||||
} else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(null, message, "", JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(null, message, "", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
|||||||
@@ -145,7 +145,8 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
JOptionPane.showMessageDialog(null, errMsg, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
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();
|
newSb.clear();
|
||||||
|
|||||||
@@ -149,10 +149,10 @@ public class GuiChoose {
|
|||||||
return order(title, top, remainingObjects, sourceChoices, destChoices, referenceCard, false);
|
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(deck);
|
||||||
Collections.sort(sideboard);
|
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.
|
// An input box for handling the order of choices.
|
||||||
final JFrame frame = new JFrame();
|
final JFrame frame = new JFrame();
|
||||||
DualListBox<T> dual = new DualListBox<T>(remainingObjects, sourceChoices, destChoices);
|
DualListBox<T> dual = new DualListBox<T>(remainingObjects, sourceChoices, destChoices);
|
||||||
dual.setSideboardMode(sideboardingMode);
|
|
||||||
dual.setSecondColumnLabelText(top);
|
dual.setSecondColumnLabelText(top);
|
||||||
|
|
||||||
frame.setLayout(new BorderLayout());
|
frame.setLayout(new BorderLayout());
|
||||||
@@ -170,6 +169,8 @@ public class GuiChoose {
|
|||||||
frame.setTitle(title);
|
frame.setTitle(title);
|
||||||
frame.setVisible(false);
|
frame.setVisible(false);
|
||||||
|
|
||||||
|
dual.setSideboardMode(sideboardingMode);
|
||||||
|
|
||||||
final JDialog dialog = new JDialog(frame, true);
|
final JDialog dialog = new JDialog(frame, true);
|
||||||
dialog.setTitle(title);
|
dialog.setTitle(title);
|
||||||
dialog.setContentPane(dual);
|
dialog.setContentPane(dual);
|
||||||
|
|||||||
Reference in New Issue
Block a user