aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-04-10 12:03:54 +0200
committerPacien TRAN-GIRARD2016-04-10 12:03:54 +0200
commit47d0af345b35660906523f9eefcf49930fe1c098 (patch)
treea8f38a00935fb92899dd2d47439e593a262b9ad7 /src
parent769b3a2726d80e67a8fbc4aae7531967b87c997a (diff)
downloadxblast-47d0af345b35660906523f9eefcf49930fe1c098.tar.gz
Take current SubCell into account when searching for central
Diffstat (limited to 'src')
-rw-r--r--src/ch/epfl/xblast/server/GameState.java7
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 /**