diff --git a/game-app/game-core/src/main/java/games/strategy/triplea/printgenerator/PlayerOrder.java b/game-app/game-core/src/main/java/games/strategy/triplea/printgenerator/PlayerOrder.java index 93580d9468..3fb639e792 100644 --- a/game-app/game-core/src/main/java/games/strategy/triplea/printgenerator/PlayerOrder.java +++ b/game-app/game-core/src/main/java/games/strategy/triplea/printgenerator/PlayerOrder.java @@ -6,6 +6,7 @@ import games.strategy.triplea.delegate.BidPurchaseDelegate; import games.strategy.triplea.delegate.EndRoundDelegate; import games.strategy.triplea.delegate.InitializationDelegate; +import games.strategy.triplea.util.PlayerOrderComparator; import java.io.IOException; import java.io.Writer; import java.nio.charset.StandardCharsets; @@ -27,7 +28,7 @@ private static Set removeDupes(final Collection c) { void saveToFile(final PrintGenerationData printData) throws IOException { for (final GameStep currentStep : printData.getData().getSequence()) { - if (currentStep.getDelegate() != null && currentStep.getDelegate().getClass() != null) { + if (currentStep.getDelegate() != null) { final String delegateClassName = currentStep.getDelegate().getClass().getName(); if (delegateClassName.equals(InitializationDelegate.class.getName()) || delegateClassName.equals(BidPurchaseDelegate.class.getName()) @@ -45,6 +46,7 @@ void saveToFile(final PrintGenerationData printData) throws IOException { playerSet.add(currentGamePlayer); } } + playerSet.sort(new PlayerOrderComparator(printData.getData())); Files.createDirectory(printData.getOutDir()); final Path outFile = printData.getOutDir().resolve("General Information.csv"); try (Writer turnWriter = diff --git a/game-app/game-core/src/main/java/games/strategy/triplea/util/PlayerOrderComparator.java b/game-app/game-core/src/main/java/games/strategy/triplea/util/PlayerOrderComparator.java index d35aba0411..bdf5d0a0d8 100644 --- a/game-app/game-core/src/main/java/games/strategy/triplea/util/PlayerOrderComparator.java +++ b/game-app/game-core/src/main/java/games/strategy/triplea/util/PlayerOrderComparator.java @@ -35,7 +35,7 @@ public int compare(final GamePlayer p1, final GamePlayer p2) { try (GameData.Unlocker ignored = gameData.acquireReadLock()) { delegate = s.getDelegate(); } - if (delegate != null && delegate.getClass() != null) { + if (delegate != null) { final String delegateClassName = delegate.getClass().getName(); if (delegateClassName.equals("games.strategy.triplea.delegate.InitializationDelegate") || delegateClassName.equals("games.strategy.triplea.delegate.BidPurchaseDelegate") @@ -44,7 +44,7 @@ public int compare(final GamePlayer p1, final GamePlayer p2) { continue; } } else if (s.getName() != null - && (s.getName().endsWith("Bid") || s.getName().endsWith("BidPlace"))) { + && (GameStep.isBidStep(s.getName()) || GameStep.isBidPlaceStep(s.getName()))) { continue; } if (s.getPlayerId().equals(p1)) {