From 2b02ca6b58d25a5234b073da6055f96b00819e3d Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 05:05:39 -0700 Subject: [PATCH] fix(editor): patrol waypoint NaN guard + 10-minute wait-time cap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NaN positions in waypoints would teleport the creature to chaos coords mid-patrol. Cap wait time at 600000ms (10 min) — prevents obvious typos (e.g. 24h = 86400000) from producing a creature that effectively never moves. --- tools/editor/npc_spawner.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/editor/npc_spawner.cpp b/tools/editor/npc_spawner.cpp index a6573415..83445546 100644 --- a/tools/editor/npc_spawner.cpp +++ b/tools/editor/npc_spawner.cpp @@ -190,7 +190,17 @@ bool NpcSpawner::loadFromFile(const std::string& path) { if (pt.is_array() && pt.size() >= 4) { PatrolPoint pp; pp.position = glm::vec3(pt[0].get(), pt[1].get(), pt[2].get()); + // Skip waypoints with NaN/inf — would produce a path + // that warps the creature to garbage coords. + if (!std::isfinite(pp.position.x) || !std::isfinite(pp.position.y) || + !std::isfinite(pp.position.z)) + continue; pp.waitTimeMs = pt[3].get(); + // Cap wait time at 10 minutes to keep AzerothCore + // happy and prevent obvious data-entry typos that + // would produce a creature that effectively never + // moves (e.g. 24h = 86400000). + if (pp.waitTimeMs > 600000) pp.waitTimeMs = 600000; s.patrolPath.push_back(pp); } }