diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-07-07 22:40:54 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-07-07 22:40:54 +0200 |
commit | 6495a1d83bbd409930fe6b80eeb4164c6299694d (patch) | |
tree | 84b59add66d290bbc20a9718b7acee792709e390 /core/src | |
parent | 29704804a9e262aea91a0e1c2881628bab1fbb3e (diff) | |
download | gdx-boardgame-6495a1d83bbd409930fe6b80eeb4164c6299694d.zip gdx-boardgame-6495a1d83bbd409930fe6b80eeb4164c6299694d.tar.gz |
HexBoard : simplify computeOrientation()
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java index 7ea7bad..19a5306 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java @@ -434,30 +434,16 @@ public class HexBoard implements Board else return (dx == 1 ? Orientation.NE : Orientation.SW); } - if (vertical) { - if (dx == 1) { - if (dy == 1) - return Orientation.NE; - else - return Orientation.SE; - } else { - if (dy == 1) - return Orientation.NW; - else - return Orientation.SW; - } + if (dx == 1) { + if (dy == 1) + return (vertical ? Orientation.NE : Orientation.E); + else + return (vertical ? Orientation.SE : Orientation.SE); } else { - if (dx == 1) { - if (dy == 1) - return Orientation.E; - else - return Orientation.SE; - } else { - if (dy == 1) - return Orientation.NW; - else - return Orientation.W; - } + if (dy == 1) + return (vertical ? Orientation.NW : Orientation.NW); + else + return (vertical ? Orientation.SW : Orientation.W); } } |