From fd3bd47424982c85f8b5c05110a1e639437bee8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 22 Jan 2020 22:10:40 +0100 Subject: Orientation : fix fromR(float) --- core/src/ch/asynk/gdx/boardgame/Orientation.java | 16 ++++++++-------- 1 file 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; } -- cgit v1.1-2-g2b99