From eb22f5dc67a236b0817a31bd50d634fb4af1c684 Mon Sep 17 00:00:00 2001 From: FullGas1 <51051389+FullGas1@users.noreply.github.com> Date: Sat, 29 Mar 2025 23:20:10 +0100 Subject: [PATCH] debug --- CTLD.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CTLD.lua b/CTLD.lua index 78e7bb9..718e380 100644 --- a/CTLD.lua +++ b/CTLD.lua @@ -8210,7 +8210,7 @@ function ctld.eventHandler:onEvent(event) if ctld.addPlayerAircraftByType then for _, aircraftType in pairs(ctld.aircraftTypeTable) do ctld.logTrace("FG_ XXXXXXXXXXXXXXXXXXX aircraftType == playerTypeName XXXXXXXXXXXXXXXXXXXXXXXX %s - %s", ctld.p(aircraftType), ctld.p(playerTypeName)) - if aircraftType == playerTypeName then + if aircraftType == playerTypeName and ctld.isValueInIpairTable(ctld.transportPilotNames, unitName) == false then ctld.logTrace("adding by aircraft type, unitName = %s", ctld.p(unitName)) -- add transport unit to the list table.insert(ctld.transportPilotNames, unitName) @@ -8238,7 +8238,7 @@ function ctld.eventHandler:onEvent(event) timer.scheduleFunction(function() ctld.logTrace("calling the 'processHumanPlayer' function in a timer") processHumanPlayer() - end, nil, timer.getTime() + 1) + end, nil, timer.getTime() + 1.5) else ctld.logTrace("calling the 'processHumanPlayer' function immediately") processHumanPlayer() @@ -8287,6 +8287,16 @@ function ctld.RandomReal(mini, maxi) return result end +-- Tools +function ctld.isValueInIpairTable(tab, value) + for i, v in ipairs(tab) do + if v == value then + return true -- La valeur existe + end + end + return false -- La valeur n'existe pas + end + --- Enable/Disable error boxes displayed on screen. env.setErrorMessageBoxEnabled(false)