From 2b19c4b17132cb753430ade0f73727ca2f9ef1be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 18 Feb 2015 11:12:34 +0100 Subject: SearchBoard: add isClearAttack(Tile, List) --- core/src/ch/asynk/tankontank/engine/SearchBoard.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 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 los) { int forth = 0; -- cgit v1.1-2-g2b99