diff options
author | Pacien TRAN-GIRARD | 2016-04-07 15:23:50 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2016-04-07 15:23:50 +0200 |
commit | 182b0806bfa7d13ff3e79a99b876122fe9cd1219 (patch) | |
tree | 021b1c3bec5c4ca97344d35e7b0c9c428d6e4b31 /src | |
parent | 7bf9f6e6195fa5c021871bd025cf8f4582a61fec (diff) | |
download | xblast-182b0806bfa7d13ff3e79a99b876122fe9cd1219.tar.gz |
Fix bomb drop event filtering
Diffstat (limited to 'src')
-rw-r--r-- | src/ch/epfl/xblast/server/GameState.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/ch/epfl/xblast/server/GameState.java b/src/ch/epfl/xblast/server/GameState.java index 3495af1..36709e9 100644 --- a/src/ch/epfl/xblast/server/GameState.java +++ b/src/ch/epfl/xblast/server/GameState.java | |||
@@ -248,8 +248,7 @@ public final class GameState { | |||
248 | * @return the newly dropped bombs | 248 | * @return the newly dropped bombs |
249 | */ | 249 | */ |
250 | private static List<Bomb> newlyDroppedBombs(List<Player> players0, Set<PlayerID> bombDropEvents, List<Bomb> bombs0) { | 250 | private static List<Bomb> newlyDroppedBombs(List<Player> players0, Set<PlayerID> bombDropEvents, List<Bomb> bombs0) { |
251 | Set<Cell> bombedCells = GameState.bombedCells(bombs0).keySet(); | 251 | HashSet<Cell> bombedCells = new HashSet<>(GameState.bombedCells(bombs0).keySet()); |
252 | |||
253 | List<Bomb> bombs1 = new ArrayList<>(); | 252 | List<Bomb> bombs1 = new ArrayList<>(); |
254 | 253 | ||
255 | for (Player p : GameState.alivePlayers(players0)) { | 254 | for (Player p : GameState.alivePlayers(players0)) { |
@@ -511,7 +510,7 @@ public final class GameState { | |||
511 | private Set<PlayerID> discardConflictingBombDropEvents(Set<PlayerID> bombDropEvents) { | 510 | private Set<PlayerID> discardConflictingBombDropEvents(Set<PlayerID> bombDropEvents) { |
512 | Map<Cell, PlayerID> bombDropMap = this.mapTopPriorityPlayerCells( | 511 | Map<Cell, PlayerID> bombDropMap = this.mapTopPriorityPlayerCells( |
513 | this.alivePlayers().stream() | 512 | this.alivePlayers().stream() |
514 | .filter(bombDropEvents::contains) | 513 | .filter(p -> bombDropEvents.contains(p.id())) |
515 | .collect(Collectors.toList()) | 514 | .collect(Collectors.toList()) |
516 | ); | 515 | ); |
517 | 516 | ||