summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/gdx/boardgame/Orientation.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Orientation.java b/core/src/ch/asynk/gdx/boardgame/Orientation.java
index e5c906b..166830a 100644
--- a/core/src/ch/asynk/gdx/boardgame/Orientation.java
+++ b/core/src/ch/asynk/gdx/boardgame/Orientation.java
@@ -84,14 +84,14 @@ public enum Orientation
public static Orientation fromR(float r)
{
if (r < 0) r += 360f;
- if ((r > ( E.r - delta)) && (r < ( E.r + delta))) return E;
- else if ((r > (NE.r - delta)) && (r < (NE.r + delta))) return NE;
- else if ((r > ( N.r - delta)) && (r < ( N.r + delta))) return N;
- else if ((r > (NW.r - delta)) && (r < (NW.r + delta))) return NW;
- else if ((r > ( W.r - delta)) && (r < ( W.r + delta))) return W;
- else if ((r > (SW.r - delta)) && (r < (SW.r + delta))) return SW;
- else if ((r > ( S.r - delta)) && (r < ( S.r + delta))) return S;
- else if ((r > (SE.r - delta)) && (r < (SE.r + delta))) return SE;
+ if ( E.r != -1 && (r > ( E.r - delta)) && (r < ( E.r + delta))) return E;
+ else if (NE.r != -1 && (r > (NE.r - delta)) && (r < (NE.r + delta))) return NE;
+ else if ( N.r != -1 && (r > ( N.r - delta)) && (r < ( N.r + delta))) return N;
+ else if (NW.r != -1 && (r > (NW.r - delta)) && (r < (NW.r + delta))) return NW;
+ else if ( W.r != -1 && (r > ( W.r - delta)) && (r < ( W.r + delta))) return W;
+ else if (SW.r != -1 && (r > (SW.r - delta)) && (r < (SW.r + delta))) return SW;
+ else if ( S.r != -1 && (r > ( S.r - delta)) && (r < ( S.r + delta))) return S;
+ else if (SE.r != -1 && (r > (SE.r - delta)) && (r < (SE.r + delta))) return SE;
else return KEEP;
}