mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-25 03:29:44 +01:00
fixed incorrect remove function and corrected a mistake during the initiation of a game over state
This commit is contained in:
parent
71a4ac8d12
commit
6475b63a22
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
@ -97,7 +98,7 @@ public class ShipMap {
|
||||
*/
|
||||
public void remove(Item item) {
|
||||
items.remove(item);
|
||||
notifyListeners(new ItemAddedEvent(item, this));
|
||||
notifyListeners(new ItemRemovedEvent(item, this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user