--*****************************************************************************
--* File: lua/modules/ui/game/unitview.lua
--* Author: Chris Blackwell
--* Summary: Rollover unit view control
--*
--* Copyright © 2005 Gas Powered Games, Inc.  All rights reserved.
--*****************************************************************************

local UIUtil = import('/lua/ui/uiutil.lua')
local LayoutHelpers = import('/lua/maui/layouthelpers.lua')
local GameCommon = import('/lua/ui/game/gamecommon.lua')
local Group = import('/lua/maui/group.lua').Group
local Bitmap = import('/lua/maui/bitmap.lua').Bitmap
local StatusBar = import('/lua/maui/statusbar.lua').StatusBar
local veterancyDefaults = import('/lua/game.lua').VeteranDefault
local Factions = import('/lua/factions.lua')
local Prefs = import('/lua/user/prefs.lua')
local EnhancementCommon = import('/lua/enhancementcommon.lua')

local rolloverInfo = false
local consTrue = false
local focusBool = false

do
   local MyUnitIdTable = {
      #'uaa0309',--t3 trans
      #'ura0309',--t3 trans
      'ura0409',-- garg
      'xab5205',--t3 air stagin
      #'xaa0307',---removed
      #'xal0310',-- wraith
      'xas0308',-- t3 frigate
      'xaa0401',-- artemis
      #'xab2306',-- t3 PD
      'xeb5205',-- t3 air stagin
      'xel0307',-- juggie
      'xel0308',--rapier
      'xel0109',-- avenger
      'xel0109b',-- avenger
      'xel0109c',-- avenger
      'xel0401',-- goliath
      'xes0306',-- t3 frigate
      'xes0402',-- bismarck
      'xea0003',-- hellfire sat
      #'xrb2306',-- t3 pd
      'xrb5205',-- t3 air stagin
      'xrl0110',-- hydra
      'xrl0205',-- scorpion
      #'xrl0307',-- hailfire
      'xrl0308',-- Basilisk
      'xrl0308b',-- Basilisk
      'xrl0308c',-- Basilisk
      'xrb4401',-- cloak field gen
      #'xrs0304',-- reaper
      #'xrs0305',-- leviathan
      'xrs0306',-- t3 frigate
      'xrs0402',-- Seadragon
      'xrl0006',-- loyalist egg
      'xrl0007',-- scorpion egg
      'xrl0008',-- deciever egg
      'xrl0009',-- firebeetle egg
      'xrl0010',-- wagner egg
      #'xrl0011',-- hailfire egg
      #'xsa0001',-- Attack drone
      #'xsa0002',-- repair drone
      #'xsa0309',-- t3 trans
      #'xsa0310',-- t3 gunship
      'xsb2402',-- rift gate
      'xsb0405',-- lambda field gen
      'xsb5205',-- t3 air stagin
      'xsa0003',-- rift gate unit
      'xsl0002',-- rift gate unit
      'xsl0003',-- rift gate unit
      'xsl0004',-- rift gate unit
      'xsl0005',-- rift gate unit
      'xsl0006',-- rift gate unit
      'xsl0007',-- rift gate unit
      'xsl0310',-- rift gate unit
      'xss0306',-- t3 frigate
      'xss0401',-- Dreadnought
      'xsb0004',-- dreadnaught naval fac
      'drlk001',-- t3 Mobile AA
	  'drlk005',-- t3 Mobile AA egg
	  'delk002',-- t3 Mobile AA
	  'dalk003',-- t3 Mobile AA
	  'dslk004',-- t3 Mobile AA
	  'xsb5104',-- t1 air stagin
	  'xeb5102',-- t1 air stagin
	  'xrb5102',-- t1 air stagin
	  'xab5102',-- t1 air stagin
	  #'xab2210',-- t2 naval mine
	  #'xeb2210',-- t2 naval mine
	  #'xrb2210',-- t2 naval mine
	  #'xsb2210',-- t2 naval mine
   }
   --unit icon must be in /icons/units/. Put the full path to the /icons/ folder in here - note no / on the end!
   local MyIconPath = "/mods/BlackOps"
   
   local function IsMyUnit(bpid)
      for i, v in MyUnitIdTable do
         if v == bpid then
            return true
         end
      end
      return false
   end
   
   local oldUpdateWindow = UpdateWindow
   function UpdateWindow(info)
      oldUpdateWindow(info)
      if IsMyUnit(info.blueprintId) and DiskGetFileInfo(MyIconPath .. '/icons/units/' .. info.blueprintId.. '_icon.dds') then
         controls.icon:SetTexture(MyIconPath .. '/icons/units/' .. info.blueprintId .. '_icon.dds')
      end
   end
end