diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-07-07 22:31:13 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-07-07 22:31:13 +0200 |
commit | 29704804a9e262aea91a0e1c2881628bab1fbb3e (patch) | |
tree | 404df44b8c177aff4125f8722f299728cd36d3d5 /core/src/ch/asynk/gdx | |
parent | 5d2e2ba668c29315129b2dfee9c4778bc1165717 (diff) | |
download | gdx-boardgame-29704804a9e262aea91a0e1c2881628bab1fbb3e.zip gdx-boardgame-29704804a9e262aea91a0e1c2881628bab1fbb3e.tar.gz |
HexBoard : third Tile in diagonal move is always on the Board
Diffstat (limited to 'core/src/ch/asynk/gdx')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java index 4cb07f4..7ea7bad 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java @@ -410,21 +410,17 @@ public class HexBoard implements Board else x += dx; // diagonal t = getTile(x, y); - if (t.isOnBoard()) { - tiles.add(t); - t.blocked = (losBlocked || blocked == 0x03); - if (t.blocked && !contact) { - Orientation o = computeOrientation(dx, dy, flat); - if (!losBlocked && blocked == 0x03) - computeContact(from, to, o, t, v, false); - else - 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, Board.Geometry.EUCLIDEAN))); - } else { - losBlocked = true; + tiles.add(t); + t.blocked = (losBlocked || blocked == 0x03); + if (t.blocked && !contact) { + Orientation o = computeOrientation(dx, dy, flat); + if (!losBlocked && blocked == 0x03) + computeContact(from, to, o, t, v, false); + else + 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, Board.Geometry.EUCLIDEAN))); } return tiles.get(tiles.size() - 1).blocked; |