Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite troops in pickup zone set to 0 after troop drop #59

Open
dsanchezseco opened this issue Mar 4, 2021 · 2 comments
Open

Infinite troops in pickup zone set to 0 after troop drop #59

dsanchezseco opened this issue Mar 4, 2021 · 2 comments

Comments

@dsanchezseco
Copy link

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).

DCS-CTLD/CTLD.lua

Line 4545 in 9fe7020

ctld.pickupZones[_index][3] = ctld.pickupZones[_index][3] + _diff

@dsanchezseco
Copy link
Author

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

@davidp57
Copy link
Collaborator

I'll check, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants