1. function SetIconTextures(control, optID)
  2.     local id = optID or control.Data.id
  3.  
  4.     -- AZ ADDITION
  5.     -- Load the unit icons into a cache instead of retrieving it every time.
  6.     -- This helps performance significantly.
  7.     if id then
  8.         if not UnitIconCache[id] then
  9.             if DiskGetFileInfo(UIUtil.UIFile('/icons/units/'..id..'_icon.dds')) then
  10.                 UnitIconCache[id] = UIUtil.UIFile('/icons/units/'..id..'_icon.dds')
  11.             else
  12.                 UnitIconCache[id] = default_icon
  13.             end
  14.         end
  15.         control.Icon:SetTexture(UnitIconCache[id])
  16.        
  17.         if __blueprints[id].StrategicIconName then
  18.             local iconName = __blueprints[id].StrategicIconName
  19.             if DiskGetFileInfo('/textures/ui/common/game/strategicicons/'..iconName..'_rest.dds') then
  20.                 control.StratIcon:SetTexture('/textures/ui/common/game/strategicicons/'..iconName..'_rest.dds')
  21.                 control.StratIcon.Height:Set(control.StratIcon.BitmapHeight)
  22.                 control.StratIcon.Width:Set(control.StratIcon.BitmapWidth)
  23.             else
  24.                 control.StratIcon:SetSolidColor('ff00ff00')
  25.             end
  26.         else
  27.             control.StratIcon:SetSolidColor('00000000')
  28.         end
  29.     else
  30.         control.Icon:SetTexture(default_icon)
  31.         control.StratIcon:SetSolidColor('ff00ff00')
  32.     end
  33.    
  34.     -- END AZ ADDITION
  35. end