From 3c4291606b93a1ccc00bbbfe2aa514f742055970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 19 Jan 2015 12:02:34 +0100 Subject: Hex: costFrom() use (Integer.MAX_VALUE/2) to avoid integer overflow --- core/src/ch/asynk/tankontank/game/Hex.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java index 5fa1ee6..1bb826c 100644 --- a/core/src/ch/asynk/tankontank/game/Hex.java +++ b/core/src/ch/asynk/tankontank/game/Hex.java @@ -102,7 +102,7 @@ public class Hex extends Tile @Override public int costFrom(Pawn pawn, Orientation side) { - if (hasUnits()) return Integer.MAX_VALUE; + if (hasUnits()) return (Integer.MAX_VALUE / 2); if (road(side)) return 1; int c = 0; @@ -117,7 +117,7 @@ public class Hex extends Tile break; case OFFMAP: case BLOCKED: - c = Integer.MAX_VALUE; + c = (Integer.MAX_VALUE / 2); break; } -- cgit v1.1-2-g2b99