diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-18 11:12:34 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-18 11:12:34 +0100 |
commit | 2b19c4b17132cb753430ade0f73727ca2f9ef1be (patch) | |
tree | 6952a928854afa1fcf055612bc04bed97269edd0 /core/src/ch | |
parent | e90b60de481ffe404c49dc5b3c0716af31866d72 (diff) | |
download | RustAndDust-2b19c4b17132cb753430ade0f73727ca2f9ef1be.zip RustAndDust-2b19c4b17132cb753430ade0f73727ca2f9ef1be.tar.gz |
SearchBoard: add isClearAttack(Tile, List<Node>)
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/SearchBoard.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java index fcd7a58..41516ae 100644 --- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java +++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java @@ -359,6 +359,16 @@ public class SearchBoard return o.isInSides(angle); } + private boolean isClearAttack(Tile from, List<Node> los) + { + int n = los.size() - 1; + for (int i = 1; i < n; i++) { + if (getTile(los.get(i)).blockLineOfSightFrom(from)) + return false; + } + return true; + } + private boolean validatePathAngle(int angle, List<Node> los) { int forth = 0; |