From 1ac55a95703072800c08da21a4f54d37c1c1bd8e Mon Sep 17 00:00:00 2001 From: Tamino Mueller Date: Mon, 7 Oct 2024 00:57:00 +0200 Subject: [PATCH] Aufgabe 7 --- .../src/main/java/pp/battleship/game/client/BattleState.java | 2 +- .../model/src/main/java/pp/battleship/model/ShipMap.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Projekte/battleship/model/src/main/java/pp/battleship/game/client/BattleState.java b/Projekte/battleship/model/src/main/java/pp/battleship/game/client/BattleState.java index fa8d731..99df8d0 100644 --- a/Projekte/battleship/model/src/main/java/pp/battleship/game/client/BattleState.java +++ b/Projekte/battleship/model/src/main/java/pp/battleship/game/client/BattleState.java @@ -60,7 +60,7 @@ class BattleState extends ClientState { if (destroyedOpponentShip(msg)) logic.getOpponentMap().add(msg.getDestroyedShip()); if (msg.isGameOver()) { - msg.getRemainingOpponentShips().forEach(logic.getOwnMap()::add); + msg.getRemainingOpponentShips().forEach(logic.getOpponentMap()::add); logic.setState(new GameOverState(logic)); } } diff --git a/Projekte/battleship/model/src/main/java/pp/battleship/model/ShipMap.java b/Projekte/battleship/model/src/main/java/pp/battleship/model/ShipMap.java index bb73d6b..83571b3 100644 --- a/Projekte/battleship/model/src/main/java/pp/battleship/model/ShipMap.java +++ b/Projekte/battleship/model/src/main/java/pp/battleship/model/ShipMap.java @@ -10,6 +10,7 @@ package pp.battleship.model; import pp.battleship.notification.GameEvent; import pp.battleship.notification.GameEventBroker; import pp.battleship.notification.ItemAddedEvent; +import pp.battleship.notification.ItemRemovedEvent; import java.util.ArrayList; import java.util.Collections; @@ -65,7 +66,7 @@ public class ShipMap { */ private void addItem(Item item) { items.add(item); - notifyListeners(new ItemAddedEvent(item, this)); + notifyListeners(new ItemRemovedEvent(item, this)); } /**