diff options
author | Pacien TRAN-GIRARD | 2016-04-10 12:03:54 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2016-04-10 12:03:54 +0200 |
commit | 47d0af345b35660906523f9eefcf49930fe1c098 (patch) | |
tree | a8f38a00935fb92899dd2d47439e593a262b9ad7 | |
parent | 769b3a2726d80e67a8fbc4aae7531967b87c997a (diff) | |
download | xblast-47d0af345b35660906523f9eefcf49930fe1c098.tar.gz |
Take current SubCell into account when searching for central
-rw-r--r-- | src/ch/epfl/xblast/server/GameState.java | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/ch/epfl/xblast/server/GameState.java b/src/ch/epfl/xblast/server/GameState.java index 22fe233..702fa37 100644 --- a/src/ch/epfl/xblast/server/GameState.java +++ b/src/ch/epfl/xblast/server/GameState.java | |||
@@ -283,8 +283,7 @@ public final class GameState { | |||
283 | * @return the truncated path | 283 | * @return the truncated path |
284 | */ | 284 | */ |
285 | private static Sq<Player.DirectedPosition> pathToNextCentralPosition(Sq<Player.DirectedPosition> p) { | 285 | private static Sq<Player.DirectedPosition> pathToNextCentralPosition(Sq<Player.DirectedPosition> p) { |
286 | return p.tail() | 286 | return p.takeWhile(dp -> !dp.position().isCentral()); |
287 | .takeWhile(dp -> dp.position().isCentral()); | ||
288 | } | 287 | } |
289 | 288 | ||
290 | /** | 289 | /** |
@@ -294,9 +293,7 @@ public final class GameState { | |||
294 | * @return the next central SubCell | 293 | * @return the next central SubCell |
295 | */ | 294 | */ |
296 | private static SubCell nextCentralPosition(Sq<Player.DirectedPosition> p) { | 295 | private static SubCell nextCentralPosition(Sq<Player.DirectedPosition> p) { |
297 | return p.tail() | 296 | return p.findFirst(dp -> dp.position().isCentral()).position(); |
298 | .findFirst(dp -> dp.position().isCentral()) | ||
299 | .position(); | ||
300 | } | 297 | } |
301 | 298 | ||
302 | /** | 299 | /** |