From bf449f3459d17c83be3f8e82edaec72da0865c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 2 May 2016 11:00:37 +0200 Subject: Pawn,Hex: road(Orientation) -> roadFrom(Orientation) --- core/src/ch/asynk/rustanddust/engine/Board.java | 2 +- core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 6 +++--- core/src/ch/asynk/rustanddust/engine/SearchBoard.java | 4 ++-- core/src/ch/asynk/rustanddust/engine/Tile.java | 2 +- core/src/ch/asynk/rustanddust/game/Hex.java | 4 ++-- core/test/ch/asynk/rustanddust/Helpers.java | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/engine/Board.java b/core/src/ch/asynk/rustanddust/engine/Board.java index 36a4926..f1e1583 100644 --- a/core/src/ch/asynk/rustanddust/engine/Board.java +++ b/core/src/ch/asynk/rustanddust/engine/Board.java @@ -383,7 +383,7 @@ public abstract class Board implements Disposable, Animation Orientation o = Orientation.fromAdj(t.col, t.row, to.col, to.row); if (o.isInSides(allowedMoves)) { o = o.opposite(); - boolean r = to.road(o); + boolean r = to.roadFrom(o); int c = to.costFrom(pawn, o); if ((c < cost) || (r && (c == cost))) { entry = o; diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java index f85a036..edac1c3 100644 --- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java +++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java @@ -156,7 +156,7 @@ public class PathBuilder implements Disposable Path good = ps.get(0); int mvt = pawn.getMovementPoints(); int cost = to.exitCost(); - int rBonus = (to.road(o) ? pawn.getRoadMarchBonus() : 0); + int rBonus = (to.roadFrom(o) ? pawn.getRoadMarchBonus() : 0); if (ps.size() > 1) { good = null; @@ -215,7 +215,7 @@ public class PathBuilder implements Disposable Orientation o = board.getSide(i); int m = (mvtLeft - next.costFrom(pawn, o)); int f = (fitness + (next.isObjectiveFor(pawn) ? 1 : 0)); - boolean r = (roadMarch && next.road(o)); + boolean r = (roadMarch && next.roadFrom(o)); int l = (m + (r ? pawn.getRoadMarchBonus() : 0)); @@ -305,7 +305,7 @@ public class PathBuilder implements Disposable { int mvt = pawn.getMovementPoints(); int cost = to.exitCost(); - int rBonus = (to.road(o) ? pawn.getRoadMarchBonus() : 0); + int rBonus = (to.roadFrom(o) ? pawn.getRoadMarchBonus() : 0); for (Path p : getPaths()) { if (pathCanExit(p, mvt, cost, rBonus)) diff --git a/core/src/ch/asynk/rustanddust/engine/SearchBoard.java b/core/src/ch/asynk/rustanddust/engine/SearchBoard.java index 803214e..01f6101 100644 --- a/core/src/ch/asynk/rustanddust/engine/SearchBoard.java +++ b/core/src/ch/asynk/rustanddust/engine/SearchBoard.java @@ -149,7 +149,7 @@ public class SearchBoard int cost = t.costFrom(pawn, board.getSide(i)); boolean mayMoveOne = first && t.atLeastOneMove(pawn); int r = src.remaining - cost; - boolean roadMarch = (src.roadMarch && t.road(board.getSide(i))); + boolean roadMarch = (src.roadMarch && t.roadFrom(board.getSide(i))); if (dst.search == searchCount) { if ((r >= 0) && ((r > dst.remaining) || (roadMarch && ((r + roadMarchBonus) >= dst.remaining)))) { @@ -188,7 +188,7 @@ public class SearchBoard if (dst != null) { Tile t = getTile(dst); - if (!t.road(board.getSide(i))) + if (!t.roadFrom(board.getSide(i))) continue; int cost = t.costFrom(pawn, board.getSide(i)); int r = src.remaining - cost; diff --git a/core/src/ch/asynk/rustanddust/engine/Tile.java b/core/src/ch/asynk/rustanddust/engine/Tile.java index 0fc3b10..9b7003d 100644 --- a/core/src/ch/asynk/rustanddust/engine/Tile.java +++ b/core/src/ch/asynk/rustanddust/engine/Tile.java @@ -43,7 +43,7 @@ public abstract class Tile implements Drawable, Disposable, Iterable public abstract boolean isOffMap(); public abstract boolean isA(TileTerrain terrain); - public abstract boolean road(Orientation side); + public abstract boolean roadFrom(Orientation side); public abstract boolean atLeastOneMove(Pawn pawn); public abstract boolean blockLineOfSight(Tile from, Tile to); diff --git a/core/src/ch/asynk/rustanddust/game/Hex.java b/core/src/ch/asynk/rustanddust/game/Hex.java index 7b37dee..34ccdb3 100644 --- a/core/src/ch/asynk/rustanddust/game/Hex.java +++ b/core/src/ch/asynk/rustanddust/game/Hex.java @@ -88,7 +88,7 @@ public class Hex extends Tile } @Override - public boolean road(Orientation side) + public boolean roadFrom(Orientation side) { return (side.s == (roads & side.s)); } @@ -104,7 +104,7 @@ public class Hex extends Tile { if (side == Orientation.KEEP) return 0; if (hasUnits()) return (Integer.MAX_VALUE / 2); - if (road(side)) return 1; + if (roadFrom(side)) return 1; int c = 0; switch(terrain) { diff --git a/core/test/ch/asynk/rustanddust/Helpers.java b/core/test/ch/asynk/rustanddust/Helpers.java index e9ca427..bc5b4d6 100644 --- a/core/test/ch/asynk/rustanddust/Helpers.java +++ b/core/test/ch/asynk/rustanddust/Helpers.java @@ -76,7 +76,7 @@ public class Helpers @Override public int defense() { return 0; } @Override public boolean isA(TileTerrain terrain) { return true; } - @Override public boolean road(Orientation side) { return false; } + @Override public boolean roadFrom(Orientation side) { return false; } @Override public boolean atLeastOneMove(Pawn pawn) { return true; } @Override public boolean blockLineOfSight(Tile from, Tile to) { return blockLineOfSight; } -- cgit v1.1-2-g2b99