diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-10-29 10:32:37 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-10-29 10:32:37 +0100 |
commit | 39af89adf75d3ca59a349254d5f87c25d1980db0 (patch) | |
tree | 26fc68833196946f457f626e9c5532b64846a8a1 /core/src/ch | |
parent | 8e574760a76596541103343184df1ed82c60cda5 (diff) | |
download | RustAndDust-39af89adf75d3ca59a349254d5f87c25d1980db0.zip RustAndDust-39af89adf75d3ca59a349254d5f87c25d1980db0.tar.gz |
SearchBoard: simplify clearVisibility logic
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/SearchBoard.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/SearchBoard.java b/core/src/ch/asynk/rustanddust/engine/SearchBoard.java index 9ca9f5d..6f7ad2f 100644 --- a/core/src/ch/asynk/rustanddust/engine/SearchBoard.java +++ b/core/src/ch/asynk/rustanddust/engine/SearchBoard.java @@ -484,18 +484,18 @@ public class SearchBoard Tile t = null; los.add(getNode(x, y)); while((x != x1) || (y != y1)) { - boolean ok = false; + boolean ok = !clearVisibility; y += d; t = board.getTile(x, y); if (!t.isOffMap()) los.add(getNode(x, y)); - if (!clearVisibility || !t.blockLineOfSightFrom(from)) + if (!ok && !t.blockLineOfSightFrom(from)) ok = true; x += d; t = board.getTile(x, y); if (!t.isOffMap()) los.add(getNode(x, y)); - if (!clearVisibility || !t.blockLineOfSightFrom(from)) + if (!ok && !t.blockLineOfSightFrom(from)) ok = true; if (!ok) @@ -523,12 +523,12 @@ public class SearchBoard Tile t = null; los.add(getNode(x, y)); while((x != x1) || (y != y1)) { - boolean ok = false; + boolean ok = !clearVisibility; x += dx; t = board.getTile(x, y); if (!t.isOffMap()) los.add(getNode(x, y)); - if (!clearVisibility || !t.blockLineOfSightFrom(from)) + if (!ok && !t.blockLineOfSightFrom(from)) ok = true; y += dy; @@ -536,7 +536,7 @@ public class SearchBoard x -= dx; t = board.getTile(x, y); if (!t.isOffMap()) los.add(getNode(x, y)); - if (!clearVisibility || !t.blockLineOfSightFrom(from)) + if (!ok && !t.blockLineOfSightFrom(from)) ok = true; if (!ok) |