summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-10-29 10:32:37 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-10-29 10:32:37 +0100
commit39af89adf75d3ca59a349254d5f87c25d1980db0 (patch)
tree26fc68833196946f457f626e9c5532b64846a8a1 /core/src
parent8e574760a76596541103343184df1ed82c60cda5 (diff)
downloadRustAndDust-39af89adf75d3ca59a349254d5f87c25d1980db0.zip
RustAndDust-39af89adf75d3ca59a349254d5f87c25d1980db0.tar.gz
SearchBoard: simplify clearVisibility logic
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/SearchBoard.java12
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)