diff options
| author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-01-19 12:02:34 +0100 | 
|---|---|---|
| committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-01-19 12:02:34 +0100 | 
| commit | 3c4291606b93a1ccc00bbbfe2aa514f742055970 (patch) | |
| tree | 448956f479f9a1de4c2d56c799d4b42d153eec5f /core | |
| parent | 5ee36005c1d18a3c673c280c786b2a724c037636 (diff) | |
| download | RustAndDust-3c4291606b93a1ccc00bbbfe2aa514f742055970.zip RustAndDust-3c4291606b93a1ccc00bbbfe2aa514f742055970.tar.gz | |
Hex: costFrom() use (Integer.MAX_VALUE/2) to  avoid integer overflow
Diffstat (limited to 'core')
| -rw-r--r-- | core/src/ch/asynk/tankontank/game/Hex.java | 4 | 
1 files 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;          } | 
