diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-01 09:39:06 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-01 09:39:06 +0200 |
commit | f9666a530c1834f23f64d4a0bd34eeab066c0560 (patch) | |
tree | e3b1b2f80cb9e6527633b211baea6d54a83fc27d /core/src/ch/asynk | |
parent | 816dce94f0cbf800853229da045adc382cfc6403 (diff) | |
download | RustAndDust-f9666a530c1834f23f64d4a0bd34eeab066c0560.zip RustAndDust-f9666a530c1834f23f64d4a0bd34eeab066c0560.tar.gz |
SearchBoard: add boolean inMap()
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/SearchBoard.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java index fea114a..536ea85 100644 --- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java +++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java @@ -71,6 +71,18 @@ public class SearchBoard this.los = new Vector<Node>(10); } + private boolean inMap(int col, int row) + { + if ((row < 0) || (row >= rows)) + return false; + + int colOffset = ((row + 1) / 2); + if ((col < colOffset) || ((col - colOffset) >= cols)) + return false; + + return true; + } + private Node getNode(int col, int row) { int colOffset = ((row + 1) / 2); |