Skip to content

Commit

Permalink
Fix stats export on 2.6. (#11730)
Browse files Browse the repository at this point in the history
This was broken by my History revamp changes.
Also fixes formatting on a comment and removes an unnecessary toString() on a param.
  • Loading branch information
asvitkine authored Jul 5, 2023
1 parent d326c18 commit b47bf38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ private void createAndSaveStats(final boolean showPhaseStats) {
if (clone == null) {
return;
}
try (PrintWriter writer =
new PrintWriter(chooser.getSelectedFile(), StandardCharsets.UTF_8.toString());
try (PrintWriter writer = new PrintWriter(chooser.getSelectedFile(), StandardCharsets.UTF_8);
GameData.Unlocker ignored = gameData.acquireReadLock()) {
writer.append(defaultFileName).println(',');
writer.append("TripleA Engine Version: ,");
Expand Down Expand Up @@ -257,8 +256,7 @@ private void createAndSaveStats(final boolean showPhaseStats) {
final List<GamePlayer> 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<IStat> stats =
Iterables.concat(
List.of(statPanel.getStats()), List.of(statPanel.getStatsExtended(gameData)));
Expand All @@ -273,6 +271,7 @@ private void createAndSaveStats(final boolean showPhaseStats) {
}
}
writer.println();
clone.getHistory().enableSeeking(null);
clone.getHistory().gotoNode(clone.getHistory().getLastNode());
final Enumeration<TreeNode> nodes =
((DefaultMutableTreeNode) clone.getHistory().getRoot()).preorderEnumeration();
Expand Down

0 comments on commit b47bf38

Please sign in to comment.