From 2166a0a440f9da0b99417d814c4bd5691917094d Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 6 Nov 2023 11:42:06 -0500 Subject: [PATCH] Method cleanup --- src/engine/gameManager/BuildingManager.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index f6585b4e..4b2c4037 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -966,24 +966,29 @@ public enum BuildingManager { public static void bakeNavMesh(Building building) { + if (building.parentZone == null) + Logger.error("Attempt to bake navmesh with no parent: " + building.getObjectUUID()); + // Build up navmesh by stencil of the - // prop's convex hull + // convex hull meshes that comprise the prop. ArrayList> convexHullList; convexHullList = _hull_data.get(building.meshUUID); for (ArrayList meshEntry : convexHullList) { - Path2D.Float stencil = new Path2D.Float(); + Path2D.Float stencilPath = new Path2D.Float(); for (Vector2f vertex : meshEntry) - stencil.moveTo(vertex.x, vertex.y); + stencilPath.moveTo(vertex.x, vertex.y); + + // enclose the path - // enclose polygon + stencilPath.moveTo(meshEntry.get(0).x, meshEntry.get(0).y); - stencil.moveTo(meshEntry.get(0).x, meshEntry.get(0).y); + // subtract stencil from zone navmesh - Area stencilArea = new Area(stencil); + Area stencilArea = new Area(stencilPath); building.parentZone.navMesh.subtract(stencilArea); }