From fe0558e62a0391ba452e2aaea7d49d3f519e3902 Mon Sep 17 00:00:00 2001 From: asvitkine Date: Mon, 3 Jul 2023 23:14:22 -0400 Subject: [PATCH 1/2] Fix stats export on 2.6. This was broken by my History revamp changes. Also fixes formatting on a comment and removes an unnecessary toString() on a param. --- .../main/java/games/strategy/engine/history/History.java | 1 - .../java/games/strategy/triplea/ui/menubar/ExportMenu.java | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/game-app/game-core/src/main/java/games/strategy/engine/history/History.java b/game-app/game-core/src/main/java/games/strategy/engine/history/History.java index 6ec8c781e0f..a36383065a7 100644 --- a/game-app/game-core/src/main/java/games/strategy/engine/history/History.java +++ b/game-app/game-core/src/main/java/games/strategy/engine/history/History.java @@ -56,7 +56,6 @@ public HistoryWriter getHistoryWriter() { } public HistoryNode enableSeeking(final HistoryPanel panel) { - Preconditions.checkNotNull(panel); Preconditions.checkState(!seekingEnabled); this.panel = panel; nextChangeIndex = changes.size(); diff --git a/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java b/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java index c7fc007d873..ff021673b50 100644 --- a/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java +++ b/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java @@ -168,7 +168,7 @@ private void createAndSaveStats(final boolean showPhaseStats) { return; } try (PrintWriter writer = - new PrintWriter(chooser.getSelectedFile(), StandardCharsets.UTF_8.toString()); + new PrintWriter(chooser.getSelectedFile(), StandardCharsets.UTF_8); GameData.Unlocker ignored = gameData.acquireReadLock()) { writer.append(defaultFileName).println(','); writer.append("TripleA Engine Version: ,"); @@ -257,8 +257,7 @@ private void createAndSaveStats(final boolean showPhaseStats) { final List players = clone.getPlayerList().getSortedPlayers(); // extended stats covers stuff that doesn't show up in the game stats menu bar, like custom - // resources or tech - // tokens or # techs, etc. + // resources or tech tokens or # techs, etc. final Iterable stats = Iterables.concat( List.of(statPanel.getStats()), List.of(statPanel.getStatsExtended(gameData))); @@ -273,6 +272,7 @@ private void createAndSaveStats(final boolean showPhaseStats) { } } writer.println(); + clone.getHistory().enableSeeking(null); clone.getHistory().gotoNode(clone.getHistory().getLastNode()); final Enumeration nodes = ((DefaultMutableTreeNode) clone.getHistory().getRoot()).preorderEnumeration(); From 6f00207e3cbf4617e03b52e8f1e51c0115f0d971 Mon Sep 17 00:00:00 2001 From: asvitkine Date: Tue, 4 Jul 2023 23:12:28 -0400 Subject: [PATCH 2/2] Formatting. --- .../java/games/strategy/triplea/ui/menubar/ExportMenu.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java b/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java index ff021673b50..2cbd28c7a55 100644 --- a/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java +++ b/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java @@ -167,8 +167,7 @@ private void createAndSaveStats(final boolean showPhaseStats) { if (clone == null) { return; } - try (PrintWriter writer = - new PrintWriter(chooser.getSelectedFile(), StandardCharsets.UTF_8); + try (PrintWriter writer = new PrintWriter(chooser.getSelectedFile(), StandardCharsets.UTF_8); GameData.Unlocker ignored = gameData.acquireReadLock()) { writer.append(defaultFileName).println(','); writer.append("TripleA Engine Version: ,");