do
--[[
# MODIFIÉ PAR MANIMAL : 25 janvier 2010
# RÉVISÉ PAR MANIMAL : 02 mars 2010
]]--

	#######################################################################
	local Game = import('/lua/game.lua')
	
	#VARIABLE ''GLOBALE'' (par Manimal)
	local MyModPath = Game.MyModPath
	#######################################################################

	# =======================================================
	# NON DESTRUCTIVE NEAT HOOK METHOD - Scripted by Manimal.
	# =======================================================

	# CONVENTIONNAL MOD ICON PATH:
	local MyIconPath = MyModPath .. '/textures/ui/common/icons/units/'

	local oldGetUnitIconFileNames = GetUnitIconFileNames


	function GetUnitIconFileNames( blueprint )

		if  not MyModPath  or  MyModPath == nil
		or  type( MyModPath ) != 'string'  or  string.len( MyModPath ) <= 0  then
			return oldGetUnitIconFileNames( blueprint ) # ORIGINAL FUNCTION
		end

		local iconName = MyIconPath .. blueprint.Display.IconName .. "_icon.dds"
		local upIconName = MyIconPath .. blueprint.Display.IconName .. "_build_btn_up.dds"
		local downIconName = MyIconPath .. blueprint.Display.IconName .. "_build_btn_down.dds"
		local overIconName = MyIconPath .. blueprint.Display.IconName .. "_build_btn_over.dds"

		if  DiskGetFileInfo( iconName ) == false  then
			return oldGetUnitIconFileNames( blueprint ) # ORIGINAL FUNCTION
		end

		if DiskGetFileInfo( upIconName ) == false then
			upIconName = iconName
		end

		if DiskGetFileInfo( downIconName ) == false then
			downIconName = iconName
		end

		if DiskGetFileInfo( overIconName ) == false then
			overIconName = iconName
		end

		return iconName, upIconName, downIconName, overIconName

	end  --FUNCTION

end  --DO

