diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-07-08 13:38:08 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-07-08 13:38:08 +0200 |
commit | e2a7408c96c5f03b81d1250161bdf7310258443f (patch) | |
tree | dcd9116b6076c6196b47d02dd5203341e5389968 | |
parent | ec856947b9b82ff7c4678a37b8246f9907cac284 (diff) | |
download | gdx-boardgame-e2a7408c96c5f03b81d1250161bdf7310258443f.zip gdx-boardgame-e2a7408c96c5f03b81d1250161bdf7310258443f.tar.gz |
HexBoard : prevent div 0 that never happen
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java index 35bfac5..cdae57b 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java @@ -444,7 +444,7 @@ public class HexBoard implements Board { float dx = to.cx - from.cx; float dy = to.cy - from.cy; - float m = dy / dx; + float m = (dx == 0 ? Float.MAX_VALUE : dy / dx); float c = from.cy - (m * from.cx); if (vertical) { if (o == Orientation.N) { |