Open dsanchezseco opened 3 years ago
proposed solution
function ctld.updateZoneCounter(_index, _diff)
if ctld.pickupZones[_index] ~= nil then
-- only update counter if amount for pickupzone is not infinite(-1)
if ctld.pickupZones[_index][3] >= 0 then
ctld.pickupZones[_index][3] = ctld.pickupZones[_index][3] + _diff
if ctld.pickupZones[_index][3] < 0 then
ctld.pickupZones[_index][3] = 0
end
if ctld.pickupZones[_index][6] ~= nil then
trigger.action.setUserFlag(ctld.pickupZones[_index][6], ctld.pickupZones[_index][3])
end
end
-- env.info(ctld.pickupZones[_index][1].." = " ..ctld.pickupZones[_index][3])
end
end
If in a pickup zone with infinite troops a group is dropped back the pickup zone counter is set to 0 (no troops available).
Problem, and solution, is that there is no check to see if the pickup has infinite troops before the sum(following line).
https://github.com/ciribob/DCS-CTLD/blob/9fe7020d6ddb49453f3abaf9314ed98b0568bebb/CTLD.lua#L4545