From e2a7408c96c5f03b81d1250161bdf7310258443f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 8 Jul 2020 13:38:08 +0200 Subject: HexBoard : prevent div 0 that never happen --- core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- cgit v1.1-2-g2b99