* remove exception on illegal move request, invalidate path and return false instead

This commit is contained in:
James McCulloch 2010-09-17 16:10:17 +00:00
parent a056b3faa8
commit 1cce764893
1 changed files with 4 additions and 1 deletions

View File

@ -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<UnitPath*>(unit->getPath())->clear();
unit->getWaypointPath()->clear();
return false;
}
const Vec2i &pos1 = unit->getPos();