From 2de038d0bc8329a80b99258a53dbeb79de348a48 Mon Sep 17 00:00:00 2001 From: Agetian Date: Sun, 10 Mar 2013 18:17:07 +0000 Subject: [PATCH 1/4] - Sealed and Draft modes do not get a visual warning for AI-unplayable cards since those consist only of picks/received cards that did not go into the main deck but were left in the sideboard. --- src/main/java/forge/game/GameNew.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/forge/game/GameNew.java b/src/main/java/forge/game/GameNew.java index 35d695e2785..9237478b61b 100644 --- a/src/main/java/forge/game/GameNew.java +++ b/src/main/java/forge/game/GameNew.java @@ -153,8 +153,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); From 8afd761a42a60df7ea3cbc52b30dfe1c26ba8082 Mon Sep 17 00:00:00 2001 From: Agetian Date: Sun, 10 Mar 2013 18:24:28 +0000 Subject: [PATCH 2/4] - Fixed the main deck title label initially not showing the number of cards when Sideboarding. --- src/main/java/forge/gui/GuiChoose.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/forge/gui/GuiChoose.java b/src/main/java/forge/gui/GuiChoose.java index cb9784894da..ad1cee846fa 100644 --- a/src/main/java/forge/gui/GuiChoose.java +++ b/src/main/java/forge/gui/GuiChoose.java @@ -161,7 +161,6 @@ public class GuiChoose { // An input box for handling the order of choices. final JFrame frame = new JFrame(); DualListBox dual = new DualListBox(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); From 187f700c2cb19944410fbc2e52298b95f9618434 Mon Sep 17 00:00:00 2001 From: Agetian Date: Sun, 10 Mar 2013 18:34:27 +0000 Subject: [PATCH 3/4] - Fixed the sideboarding code not allowing a deck with more cards than the original deck in Limited (Sealed, Draft) modes. --- src/main/java/forge/game/player/PlayerControllerHuman.java | 3 ++- src/main/java/forge/gui/GuiChoose.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/forge/game/player/PlayerControllerHuman.java b/src/main/java/forge/game/player/PlayerControllerHuman.java index 0ed479af529..0282bde6975 100644 --- a/src/main/java/forge/game/player/PlayerControllerHuman.java +++ b/src/main/java/forge/game/player/PlayerControllerHuman.java @@ -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(); diff --git a/src/main/java/forge/gui/GuiChoose.java b/src/main/java/forge/gui/GuiChoose.java index ad1cee846fa..bdfe19f9dec 100644 --- a/src/main/java/forge/gui/GuiChoose.java +++ b/src/main/java/forge/gui/GuiChoose.java @@ -149,10 +149,10 @@ public class GuiChoose { return order(title, top, remainingObjects, sourceChoices, destChoices, referenceCard, false); } - public static > List sideboard(List sideboard, List deck) { + public static > List sideboard(List sideboard, List 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); } From c568a7cae254cfbfed52e460b0aa5d78c6d7508e Mon Sep 17 00:00:00 2001 From: myk Date: Sun, 10 Mar 2013 21:39:26 +0000 Subject: [PATCH 4/4] truncate stack overflow error traces so the resulting messages aren't too long to post --- src/main/java/forge/error/BugReporter.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/forge/error/BugReporter.java b/src/main/java/forge/error/BugReporter.java index 5a3c91908b3..002a1dc15c4 100644 --- a/src/main/java/forge/error/BugReporter.java +++ b/src/main/java/forge/error/BugReporter.java @@ -65,6 +65,8 @@ import forge.properties.NewConstants; * @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. @@ -90,7 +92,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);