summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-07-07 14:10:47 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-07-07 14:10:47 +0200
commitdacf116e1bbeb1bec86993cd145f8f9a201e9551 (patch)
treeb0c348bbaca851c02cb7a6d231b05c5933293745 /core
parenta6c03e7c812af6da3e4fd799bb47f09366105b1a (diff)
downloadgdx-boardgame-dacf116e1bbeb1bec86993cd145f8f9a201e9551.zip
gdx-boardgame-dacf116e1bbeb1bec86993cd145f8f9a201e9551.tar.gz
HexBoard : distance cleanup
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java
index 18aba17..21277d8 100644
--- a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java
+++ b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java
@@ -254,14 +254,11 @@ public class HexBoard implements Board
if (dx > dy) {
if (dx > dz)
return dx;
- else
- return dz;
} else {
if (dy > dz)
return dy;
- else
- return dz;
}
+ return dz;
}
}
@@ -314,7 +311,7 @@ public class HexBoard implements Board
Tile from = getTile(x0, y0);
Tile to = getTile(x1, y1);
- float d = distance(x0, y0, x1, y1);
+ float d = distance(x0, y0, x1, y1, Board.Geometry.EUCLIDEAN);
tiles.add(from);
from.blocked = false;
boolean contact = false;
@@ -355,7 +352,7 @@ public class HexBoard implements Board
}
tiles.add(t);
t.blocked = losBlocked;
- losBlocked = (losBlocked || t.blockLos(from, to, d, distance(x0, y0, x, y)));
+ losBlocked = (losBlocked || t.blockLos(from, to, d, distance(x0, y0, x, y, Board.Geometry.EUCLIDEAN)));
}
return tiles.get(tiles.size() - 1).blocked;
@@ -371,7 +368,7 @@ public class HexBoard implements Board
Tile from = getTile(x0, y0);
Tile to = getTile(x1, y1);
- float d = distance(x0, y0, x1, y1);
+ float d = distance(x0, y0, x1, y1, Board.Geometry.EUCLIDEAN);
tiles.add(from);
from.blocked = false;
int blocked = 0;
@@ -387,7 +384,7 @@ public class HexBoard implements Board
if (t.isOnBoard()) {
tiles.add(t);
t.blocked = losBlocked;
- if (t.blockLos(from, to, d, distance(x0, y0, x, y)))
+ if (t.blockLos(from, to, d, distance(x0, y0, x, y, Board.Geometry.EUCLIDEAN)))
blocked |= 0x01;
}
@@ -401,7 +398,7 @@ public class HexBoard implements Board
if (t.isOnBoard()) {
tiles.add(t);
t.blocked = losBlocked;
- if (t.blockLos(from, to, d, distance(x0, y0, x, y)))
+ if (t.blockLos(from, to, d, distance(x0, y0, x, y, Board.Geometry.EUCLIDEAN)))
blocked |= 0x02;
}
@@ -421,7 +418,7 @@ public class HexBoard implements Board
computeContact(from, to, o.opposite(), tiles.get(tiles.size() - 4), v, false);
contact = true;
}
- losBlocked = (t.blocked || t.blockLos(from, to, d, distance(x0, y0, x, y)));
+ losBlocked = (t.blocked || t.blockLos(from, to, d, distance(x0, y0, x, y, Board.Geometry.EUCLIDEAN)));
}
}