summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/gdx
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-01-22 22:10:40 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2020-01-22 22:10:40 +0100
commitfd3bd47424982c85f8b5c05110a1e639437bee8f (patch)
treee23f33a45471c9f8684b109c80186c1ecd8a2365 /core/src/ch/asynk/gdx
parent6c3a48e5bf3e9efa91995ecf5edf7fb0a1d2e2e6 (diff)
downloadgdx-boardgame-fd3bd47424982c85f8b5c05110a1e639437bee8f.zip
gdx-boardgame-fd3bd47424982c85f8b5c05110a1e639437bee8f.tar.gz
Orientation : fix fromR(float)
Diffstat (limited to 'core/src/ch/asynk/gdx')
-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;
}