function SetIconTextures(control, optID)
local id = optID or control.Data.id
-- AZ ADDITION
-- Load the unit icons into a cache instead of retrieving it every time.
-- This helps performance significantly.
if id then
if not UnitIconCache[id] then
if DiskGetFileInfo(UIUtil.UIFile('/icons/units/'..id..'_icon.dds')) then
UnitIconCache[id] = UIUtil.UIFile('/icons/units/'..id..'_icon.dds')
else
UnitIconCache[id] = default_icon
end
end
control.Icon:SetTexture(UnitIconCache[id])
if __blueprints[id].StrategicIconName then
local iconName = __blueprints[id].StrategicIconName
if DiskGetFileInfo('/textures/ui/common/game/strategicicons/'..iconName..'_rest.dds') then
control.StratIcon:SetTexture('/textures/ui/common/game/strategicicons/'..iconName..'_rest.dds')
control.StratIcon.Height:Set(control.StratIcon.BitmapHeight)
control.StratIcon.Width:Set(control.StratIcon.BitmapWidth)
else
control.StratIcon:SetSolidColor('ff00ff00')
end
else
control.StratIcon:SetSolidColor('00000000')
end
else
control.Icon:SetTexture(default_icon)
control.StratIcon:SetSolidColor('ff00ff00')
end
-- END AZ ADDITION
end