Core/MMaps: Add several safety checks to confirm a valid path generation.

- Address some issues in TargetMovementGenerator. Thanks Chevron
This commit is contained in:
kaelima
2012-09-07 04:21:11 +02:00
parent 0522e50c86
commit a2d533752c
8 changed files with 46 additions and 40 deletions
@@ -153,16 +153,18 @@ namespace Movement
if (generatePath)
{
PathGenerator path(unit);
path.CalculatePath(dest.x, dest.y, dest.z, forceDestination);
MovebyPath(path.GetPath());
}
else
{
args.path_Idx_offset = 0;
args.path.resize(2);
TransportPathTransform transform(unit, args.TransformForTransport);
args.path[1] = transform(dest);
bool result = path.CalculatePath(dest.x, dest.y, dest.z, forceDestination);
if (result && path.GetPathType() & ~PATHFIND_NOPATH)
{
MovebyPath(path.GetPath());
return;
}
}
args.path_Idx_offset = 0;
args.path.resize(2);
TransportPathTransform transform(unit, args.TransformForTransport);
args.path[1] = transform(dest);
}
Vector3 TransportPathTransform::operator()(Vector3 input)