Aufgabe 7

This commit is contained in:
Tamino Mueller 2024-10-07 00:57:00 +02:00
parent f47cda7dc4
commit 1ac55a9570
2 changed files with 3 additions and 2 deletions

View File

@ -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));
}
}

View File

@ -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));
}
/**