mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #1044 from cjbehm/bugfix/CONTROLLABLE-honor-GotPath
Honor the GotPath return value from COORDINATE
This commit is contained in:
commit
006fd25e56
@ -2101,7 +2101,7 @@ do -- Route methods
|
|||||||
FromCoordinate = FromCoordinate or self:GetCoordinate()
|
FromCoordinate = FromCoordinate or self:GetCoordinate()
|
||||||
|
|
||||||
-- Get path and path length on road including the end points (From and To).
|
-- Get path and path length on road including the end points (From and To).
|
||||||
local PathOnRoad, LengthOnRoad=FromCoordinate:GetPathOnRoad(ToCoordinate, true)
|
local PathOnRoad, LengthOnRoad, GotPath =FromCoordinate:GetPathOnRoad(ToCoordinate, true)
|
||||||
|
|
||||||
-- Get the length only(!) on the road.
|
-- Get the length only(!) on the road.
|
||||||
local _,LengthRoad=FromCoordinate:GetPathOnRoad(ToCoordinate, false)
|
local _,LengthRoad=FromCoordinate:GetPathOnRoad(ToCoordinate, false)
|
||||||
@ -2113,7 +2113,7 @@ do -- Route methods
|
|||||||
-- Calculate the direct distance between the initial and final points.
|
-- Calculate the direct distance between the initial and final points.
|
||||||
local LengthDirect=FromCoordinate:Get2DDistance(ToCoordinate)
|
local LengthDirect=FromCoordinate:Get2DDistance(ToCoordinate)
|
||||||
|
|
||||||
if PathOnRoad then
|
if GotPath then
|
||||||
|
|
||||||
-- Off road part of the rout: Total=OffRoad+OnRoad.
|
-- Off road part of the rout: Total=OffRoad+OnRoad.
|
||||||
LengthOffRoad=LengthOnRoad-LengthRoad
|
LengthOffRoad=LengthOnRoad-LengthRoad
|
||||||
@ -2136,7 +2136,7 @@ do -- Route methods
|
|||||||
local canroad=false
|
local canroad=false
|
||||||
|
|
||||||
-- Check if a valid path on road could be found.
|
-- Check if a valid path on road could be found.
|
||||||
if PathOnRoad and LengthDirect > 2000 then -- if the length of the movement is less than 1 km, drive directly.
|
if GotPath and LengthDirect > 2000 then -- if the length of the movement is less than 1 km, drive directly.
|
||||||
-- Check whether the road is very long compared to direct path.
|
-- Check whether the road is very long compared to direct path.
|
||||||
if LongRoad and Shortcut then
|
if LongRoad and Shortcut then
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user