From e266acaa95df34b4bb261ca62a687755cf48230e Mon Sep 17 00:00:00 2001 From: David Pierron Date: Thu, 14 Nov 2024 16:17:51 +0100 Subject: [PATCH] corrected a bug: the units listed in the ctld.transportPilotNames didn't have a F10 menu --- CTLD.lua | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/CTLD.lua b/CTLD.lua index 2ed4026..6923237 100644 --- a/CTLD.lua +++ b/CTLD.lua @@ -7212,35 +7212,23 @@ function ctld.eventHandler:onEvent(event) local playerTypeName = _unit:getTypeName() ctld.logTrace("playerTypeName = %s", ctld.p(playerTypeName)) - local notFound = true - - for _,transportPilotName in pairs(ctld.transportPilotNames) do - if transportPilotName == unitName then - ctld.logDebug("Unit is already a transport pilot, skipping...") - notFound = false - break - end - end - - if notFound then - -- Allow units to CTLD by aircraft type and not by pilot name - if ctld.addPlayerAircraftByType then - for _,aircraftType in pairs(ctld.aircraftTypeTable) do - if aircraftType == playerTypeName then - -- add transport unit to the list - table.insert(ctld.transportPilotNames, unitName) - -- add transport radio menu - ctld.addTransportF10MenuOptions(unitName) - break - end + -- Allow units to CTLD by aircraft type and not by pilot name + if ctld.addPlayerAircraftByType then + for _,aircraftType in pairs(ctld.aircraftTypeTable) do + if aircraftType == playerTypeName then + -- add transport unit to the list + table.insert(ctld.transportPilotNames, unitName) + -- add transport radio menu + ctld.addTransportF10MenuOptions(unitName) + break end - else - for _, _unitName in pairs(ctld.transportPilotNames) do - if _unitName == unitName then - -- add transport radio menu - ctld.addTransportF10MenuOptions(unitName) - break - end + end + else + for _, _unitName in pairs(ctld.transportPilotNames) do + if _unitName == unitName then + -- add transport radio menu + ctld.addTransportF10MenuOptions(unitName) + break end end end