summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-07-08 13:38:08 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-07-08 13:38:08 +0200
commite2a7408c96c5f03b81d1250161bdf7310258443f (patch)
treedcd9116b6076c6196b47d02dd5203341e5389968 /core/src/ch
parentec856947b9b82ff7c4678a37b8246f9907cac284 (diff)
downloadgdx-boardgame-e2a7408c96c5f03b81d1250161bdf7310258443f.zip
gdx-boardgame-e2a7408c96c5f03b81d1250161bdf7310258443f.tar.gz
HexBoard : prevent div 0 that never happen
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java2
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) {