Updated bug in Detection and other classes. Now only alive units are considered when broadcasting a message to a SET_GROUP. Made DESIGNATE crash in certain cases.

This commit is contained in:
FlightControl 2019-03-17 07:33:28 +01:00
parent 837361e899
commit 0ea5c7fa48
3 changed files with 7 additions and 7 deletions

View File

@ -1393,7 +1393,7 @@ do -- DESIGNATE
self:F( "Smoking ..." )
local RecceGroup = self.RecceSet:FindNearestGroupFromPointVec2(SmokeUnit:GetPointVec2())
local RecceUnit = RecceGroup:GetUnit( 1 )
local RecceUnit = RecceGroup:GetUnit( 1 ) -- Wrapper.Unit#UNIT
if RecceUnit then

View File

@ -1524,12 +1524,12 @@ do -- DETECTION_BASE
local DetectedItem = {}
self.DetectedItemCount = self.DetectedItemCount + 1
self.DetectedItemMax = self.DetectedItemMax + 1
DetectedItemKey = DetectedItemKey or self.DetectedItemMax
self.DetectedItems[DetectedItemKey] = DetectedItem
local DetectedItemIndex = DetectedItemKey or self.DetectedItemMax
self.DetectedItemsByIndex[DetectedItemIndex] = DetectedItem
DetectedItem.Index = DetectedItemIndex
self.DetectedItemsByIndex[DetectedItemKey] = DetectedItem
DetectedItem.Index = DetectedItemKey
DetectedItem.Set = Set or SET_UNIT:New():FilterDeads():FilterCrashes()
DetectedItem.ItemID = ItemPrefix .. "." .. self.DetectedItemMax

View File

@ -1101,7 +1101,7 @@ function POSITIONABLE:MessageToSetGroup( Message, Duration, MessageSetGroup, Nam
local DCSObject = self:GetDCSObject()
if DCSObject then
if DCSObject:isExist() then
MessageSetGroup:ForEachGroup(
MessageSetGroup:ForEachGroupAlive(
function( MessageGroup )
self:GetMessage( Message, Duration, Name ):ToGroup( MessageGroup )
end