From 6fb576709dfb873f6106d3c1c5609af377fd52e1 Mon Sep 17 00:00:00 2001 From: asvitkine Date: Sun, 16 Jul 2023 07:27:30 -0400 Subject: [PATCH] Fix tests. --- .../main/java/games/strategy/engine/data/GameData.java | 8 ++++++++ .../games/strategy/engine/framework/GameDataManager.java | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/game-app/game-core/src/main/java/games/strategy/engine/data/GameData.java b/game-app/game-core/src/main/java/games/strategy/engine/data/GameData.java index c4c76191596..980b6c362d3 100644 --- a/game-app/game-core/src/main/java/games/strategy/engine/data/GameData.java +++ b/game-app/game-core/src/main/java/games/strategy/engine/data/GameData.java @@ -395,6 +395,14 @@ private void fixUpNullPlayers() { } } + @RemoveOnNextMajorRelease + public void fixUpNullPlayersInDelegates() { + BattleDelegate battleDelegate = (BattleDelegate) getDelegate("battle"); + if (battleDelegate != null) { + battleDelegate.getBattleTracker().fixUpNullPlayers(playerList.getNullPlayer()); + } + } + public interface Unlocker extends Closeable { @Override void close(); diff --git a/game-app/game-core/src/main/java/games/strategy/engine/framework/GameDataManager.java b/game-app/game-core/src/main/java/games/strategy/engine/framework/GameDataManager.java index 9a03b8a44e8..7eb257c1f25 100644 --- a/game-app/game-core/src/main/java/games/strategy/engine/framework/GameDataManager.java +++ b/game-app/game-core/src/main/java/games/strategy/engine/framework/GameDataManager.java @@ -74,9 +74,7 @@ public static Optional loadGameUncompressed(final InputStream is) { final GameData data = (GameData) input.readObject(); data.postDeSerialize(); loadDelegates(input, data); - data.getBattleDelegate() - .getBattleTracker() - .fixUpNullPlayers(data.getPlayerList().getNullPlayer()); + data.fixUpNullPlayersInDelegates(); return Optional.of(data); } catch (final Throwable e) { log.warn(