View Issue Details

IDProjectCategoryView StatusLast Update
0005087Spring engineGeneralpublic2016-02-13 00:46
Reportersilentwings Assigned Tohokomoko  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Product Version100.0+git 
Summary0005087: Spring.GetUnitIsTransporting returns incorrect values if more than one transport is queried
DescriptionIf a single transporter is selected, Spring.GetUnitIsTransporting() returns the correct table.

If two transporters are selection, and Spring.GetUnitIsTransporting() is called for both of them, the second transporter than it is called for has nils where there should be unitIDs.
Steps To ReproduceWith bar:test, use the widget below.
Give 2 corvalk, and 2 corocom
Load one corcom into each corvalk
Select each corvalk independently, and press Z, to see the widget echo
Select both corvalk togeter, and press Z, and the widget will crash because tID is nil for the second transporter
Additional Informationfunction widget:GetInfo()
    return {
        name = "Test_2",
        version = "0",
        desc = "",
        author = "",
        date = "",
        license = "",
        layer = 0,
        enabled = true
    }
end

include('keysym.h.lua')

function widget:KeyPress(key,_,_)
    if key==KEYSYMS.Z then
        local sUnits = Spring.GetSelectedUnits()
        for i=1,#sUnits do
            local unitID = sUnits[i]
            local transported = Spring.GetUnitIsTransporting(unitID)
            Spring.Echo(UnitDefs[Spring.GetUnitDefID(unitID)].name .. " is transporting " .. #transported .. " units. Their unitIDs are:")
            for j=1,#transported do
                local tID = transported[i]
                Spring.Echo(" " .. tID)
            end
        end
    end
end
TagsNo tags attached.
Checked infolog.txt for Errors

Activities

hokomoko

2016-02-13 00:46

developer   ~0015755

should be local tID = transported[j]

Issue History

Date Modified Username Field Change
2016-02-13 00:14 silentwings New Issue
2016-02-13 00:45 hokomoko Status new => closed
2016-02-13 00:45 hokomoko Assigned To => hokomoko
2016-02-13 00:45 hokomoko Resolution open => no change required
2016-02-13 00:46 hokomoko Note Added: 0015755
2016-02-13 00:46 hokomoko Status closed => feedback
2016-02-13 00:46 hokomoko Resolution no change required => reopened
2016-02-13 00:46 hokomoko Status feedback => closed
2016-02-13 00:46 hokomoko Resolution reopened => no change required