From 1cce764893d5ba3295e900a73e543445d3305820 Mon Sep 17 00:00:00 2001 From: James McCulloch Date: Fri, 17 Sep 2010 16:10:17 +0000 Subject: [PATCH] * remove exception on illegal move request, invalidate path and return false instead --- source/glest_game/ai/route_planner.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/glest_game/ai/route_planner.cpp b/source/glest_game/ai/route_planner.cpp index 38376ed9..ba1d1b5d 100644 --- a/source/glest_game/ai/route_planner.cpp +++ b/source/glest_game/ai/route_planner.cpp @@ -141,7 +141,10 @@ bool RoutePlanner::isLegalMove(Unit *unit, const Vec2i &pos2) const { float d = unit->getPos().dist(pos2); if (d > 1.5 || d < 0.9f) { - throw runtime_error("The new Pathfinder lied."); + // path is invalid, this shouldn't happen... but it does. + static_cast(unit->getPath())->clear(); + unit->getWaypointPath()->clear(); + return false; } const Vec2i &pos1 = unit->getPos();