From 89830a19040c90bd9ae28bdd94171a751928e3f0 Mon Sep 17 00:00:00 2001 From: Torrie Fischer Date: Mon, 14 Jun 2021 13:24:51 -0700 Subject: [PATCH] geometry: bordermesh: make sure we can still do travel even if a mesh cannot be generated --- .../java/us/camin/regions/geometry/BorderMesh.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/us/camin/regions/geometry/BorderMesh.java b/src/main/java/us/camin/regions/geometry/BorderMesh.java index b79ecf8..10ae01c 100644 --- a/src/main/java/us/camin/regions/geometry/BorderMesh.java +++ b/src/main/java/us/camin/regions/geometry/BorderMesh.java @@ -113,7 +113,16 @@ public class BorderMesh { log.warning("Got a null pointer when triangulating, skipping world."); return false; } catch (NotEnoughPointsException e) { - log.info("Not enough points to triangulate mesh. Add more regions!"); + log.info("Not enough points to triangulate mesh, all regions will be connected to each other. Add more regions!"); + for(Region region : m_regions) { + HashSet neighbors = new HashSet(); + for(Region neighbor : m_regions) { + if (neighbor != region) { + neighbors.add(neighbor); + } + } + m_neighbors.put(region, neighbors); + } return false; }