Fix crash with markings

* Fixed a crash with markings
* Optimized the detailed report of a task
This commit is contained in:
FlightControl_Master 2017-09-15 13:42:08 +02:00
parent 6a725475c9
commit bae6219b7a
2 changed files with 27 additions and 15 deletions

View File

@ -338,7 +338,7 @@ do -- COORDINATE
-- @return #string
function COORDINATE:GetMovingText( Settings )
return self:GetVelocityText( Settings ) .. self:GetHeadingText( Settings )
return self:GetVelocityText( Settings ) .. ", " .. self:GetHeadingText( Settings )
end
@ -350,6 +350,7 @@ do -- COORDINATE
return { x = TargetCoordinate.x - self.x, y = TargetCoordinate.y - self.y, z = TargetCoordinate.z - self.z }
end
--- Get a correction in radians of the real magnetic north of the COORDINATE.
-- @param #COORDINATE self
-- @return #number CorrectionRadians The correction in radians.

View File

@ -879,19 +879,20 @@ function TASK:MenuMarkToGroup( TaskGroup )
local TaskInfoIDText = "" --string.format( "%s: ", TaskInfoID )
if type( TaskInfo.TaskInfoText ) == "string" then
Report:Add( TaskInfoIDText .. TaskInfo.TaskInfoText )
elseif type(TaskInfo) == "table" then
if TaskInfoID == "Targets" then
else
Report:Add( TaskInfoIDText .. TaskInfo.TaskInfoText )
end
elseif type( TaskInfo ) == "table" then
if TaskInfoID == "Coordinates" then
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
Report:Add( TaskInfoIDText .. ToCoordinate:ToString() )
--local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
--Report:Add( TaskInfoIDText .. ToCoordinate:ToString() )
else
end
end
end
self:E("ok5")
local Coordinate = self:GetInfo( "Coordinates" ) -- Core.Point#COORDINATE
local Velocity = self.TargetSetUnit:GetVelocity()
@ -1564,6 +1565,8 @@ function TASK:ReportDetails( ReportGroup )
-- Determine the status of the Task.
local Status = "<" .. self:GetState() .. ">"
Report:Add( "Task: " .. Name .. " - " .. Status .. " - Detailed Report" )
-- Loop each Unit active in the Task, and find Player Names.
local PlayerNames = self:GetPlayerNames()
@ -1572,10 +1575,11 @@ function TASK:ReportDetails( ReportGroup )
PlayerReport:Add( "Group " .. PlayerGroup:GetCallsign() .. ": " .. PlayerName )
end
local Players = PlayerReport:Text()
Report:Add( "Task: " .. Name .. " - " .. Status .. " - Detailed Report" )
Report:Add( " - Players:" )
Report:AddIndent( Players )
if Players ~= "" then
Report:Add( " - Players assigned:" )
Report:AddIndent( Players )
end
for TaskInfoID, TaskInfo in pairs( self.TaskInfo, function( t, a, b ) return t[a].TaskInfoOrder < t[b].TaskInfoOrder end ) do
@ -1585,17 +1589,24 @@ function TASK:ReportDetails( ReportGroup )
Report:Add( TaskInfoIDText .. TaskInfo.TaskInfoText )
elseif type(TaskInfo) == "table" then
if TaskInfoID == "Coordinates" then
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
Report:Add( TaskInfoIDText )
Report:AddIndent( ToCoordinate:ToStringBRA( FromCoordinate ) .. ", " .. TaskInfo.TaskInfoText:ToStringAspect( FromCoordinate ) )
Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) )
Report:Add( TaskInfoIDText .. ToCoordinate:ToString() )
else
end
end
end
local Coordinate = self:GetInfo( "Coordinates" ) -- Core.Point#COORDINATE
local Velocity = self.TargetSetUnit:GetVelocity()
local Heading = self.TargetSetUnit:GetHeading()
Coordinate:SetHeading( Heading )
Coordinate:SetVelocity( Velocity )
Report:Add( "Targets are" .. Coordinate:GetMovingText() .. "." )
return Report:Text()
end