local iconTypes = {
    default = {
        bitmap   = "icons/alert.tga",
        size     = 0, --5,
        distance = 5000,
    },
    pistol = {
        bitmap   = "icons/pistol.tga",
        size     = 1.0,
        distance = 0.15,
    },
    rifle = {
        bitmap   = "icons/rifle.tga",
        size     = 1.65,
        distance = 0.15,
    },
    paratrooper = {
        bitmap   = "icons/rifle.tga",
        size     = 1.65,
        distance = 5000,
    },
    assault = {
        bitmap   = "icons/assault.tga",
        size     = 1.5,
        distance = 0.15,
    },
    antitank = {
        bitmap   = "icons/antitank.tga",
        size     = 1.5,
        distance = 0.15,
    },
    mortar = {
        bitmap   = "icons/mortar.tga",
        size     = 2.5,
        distance = 0.15,
    },
    sniper = {
        bitmap   = "icons/sniper.tga",
        size     = 1.8,
        distance = 0.15,
    },
    officer = {
        bitmap   = "icons/binos.tga",
        size     = 1.4,
        distance = 0.15,
    },
    engineer = {
        bitmap   = "icons/engineer.tga",
        size     = 2,
        distance = 0.15,
    },
    advancedengineer = {
        bitmap   = "icons/engineer2.tga",
        size     = 2,
        distance = 0.15,
    },
    engineervehicle = {
        bitmap   = "icons/engineervehicle.tga",
        size     = 2.25,
        distance = 0.2,
    },
    lightmg = {
        bitmap   = "icons/lightmg.tga",
        size     = 3,
        distance = 0.15,
    },
    bar = {
        bitmap   = "icons/bar.tga",
        size     = 2.25,
        distance = 0.15,
    },
    flame = {
        bitmap   = "icons/flame.tga",
        size     = 2.25,
        distance = 0.15,
    },
    aaartillery = {
        bitmap   = "icons/aaartillery.tga",
        size     = 3,
        distance = 0.2,
    },
    atartillery = {
        bitmap   = "icons/ATartillery.tga",
        size     = 3.25,
        distance = 0.25,
    },
    aahalftrack = {
        bitmap   = "icons/aahalftrack.tga",
        size     = 3,
        distance = 0.2,
    },
    aacar = {
        bitmap   = "icons/AAcar.tga",
        size     = 2,
        distance = 0.2,
    },
    aatruck = {
        bitmap   = "icons/AAtruck.tga",
        size     = 2,
        distance = 0.2,
    },
    attruck = {
        bitmap   = "icons/ATtruck.tga",
        size     = 2,
        distance = 0.2,
    },
    fgtruck = {
        bitmap   = "icons/FGtruck.tga",
        size     = 2,
        distance = 0.2,
    },
    armoredcar = {
        bitmap   = "icons/armoredcar.tga",
        size     = 2,
        distance = 0.2,
    },
    artillery = {
        bitmap   = "icons/artillery.tga",
        size     = 3.25,
        distance = 0.25,
    },
    bomber = {
        bitmap   = "icons/bomber.tga",
        size     = 2.5,
        distance = 1,
    },
    fighter = {
        bitmap   = "icons/fighter.tga",
        size     = 2.5,
        distance = 1,
    },
    fighterbomber = {
        bitmap   = "icons/fighterbomber.tga",
        size     = 2.5,
        distance = 1,
    },
    halftrack = {
        bitmap   = "icons/halftrack.tga",
        size     = 2,
        distance = 0.2,
    },
    heavytank = {
        bitmap   = "icons/heavytank.tga",
        size     = 2.75,
        distance = 0.4,
    },
    medtank = {
        bitmap   = "icons/medtank.tga",
        size     = 2,
        distance = 0.3,
    },
    lighttank = {
        bitmap   = "icons/medtank.tga",
        size     = 1.75,
        distance = 0.3,
    },
    jeep = {
        bitmap   = "icons/jeep.tga",
        size     = 2.25,
        distance = 0.2,
    },
    recon = {
        bitmap   = "icons/recon.tga",
        size     = 2.25,
        distance = 0.75,
    },
    selfprop = {
        bitmap   = "icons/selfprop.tga",
        size     = 2,
        distance = 0.3,
    },
    sparty = {
        bitmap   = "icons/sparty.tga",
        size     = 2.25,
        distance = 0.3,
    },
    stockpile = {
        bitmap   = "icons/stockpile.tga",
        size     = 3,
        distance = 0.25,
    },
    rockettruck = {
        bitmap   = "icons/rockettruck.tga",
        size     = 2.5,
        distance = 0.25,
    },
    truck = {
        bitmap   = "icons/truck.tga",
        size     = 2,
        distance = 0.2,
    },
    ptruck = {
        bitmap   = "icons/ptruck.tga",
        size     = 2,
        distance = 0.2,
    },
    truck_ammo = {
        bitmap   = "icons/truck_ammo.png",
        size     = 2,
        distance = 0.2,
    },
    truck_factory = {
        bitmap   = "icons/truck_factory.png",
        size     = 2,
        distance = 0.2,
    },
    truck_barracks = {
        bitmap   = "icons/truck_barracks.png",
        size     = 2,
        distance = 0.2,
    },
    htruck = {
        bitmap   = "icons/Htruck.tga",
        size     = 2,
        distance = 0.2,
    },
    rtruck = {
        bitmap   = "icons/Rtruck.tga",
        size     = 2,
        distance = 0.2,
    },
    ammo = {
        bitmap   = "icons/ammo.tga",
        size     = 2.25,
        distance = 0.3,
    },
    ammo2 = {
        bitmap   = "icons/ammo2.tga",
        size     = 2.25,
        distance = 0.3,
    },    
    factory = {
        bitmap   = "icons/factory.tga",
        size     = 2.75,
        distance = 0.4,
    },
    mines = {
        bitmap   = "icons/guard.tga",
        size     = 0.0001,
        distance = 80,
    },
    partisan = {
        bitmap   = "icons/partisan.tga",
        size     = 1.65,
        distance = 0.15,
    },
    commando = {
        bitmap   = "icons/commando.tga",
        size     = 2,
        distance = 0.15,
    },
    rubber = {
        bitmap   = "icons/rubber.tga",
        size     = 2.5,
        distance = 0.4,
    },
    lttrans = {
        bitmap   = "icons/lttrans.tga",
        size     = 2.5,
        distance = 0.4,
    },
    raft    = {
        bitmap   = "icons/raft.tga",
        size     = 2.5,
        distance = 0.4,
    },
    barracks = {
        bitmap   = "icons/barracks.tga",
        size     = 3,
        distance = 0.4,
    },
    radar = {
        bitmap   = "icons/radar.tga",
        size     = 4,
        distance = 0.3,
    },
    flag = {
        bitmap   = "icons/flag.tga",
        size     = 2.5,
        distance = 0.3,
    },
    shack = {
        bitmap   = "icons/shack.tga",
        size     = 2.75,
        distance = 0.3,
    },
    shipyard = {
        bitmap   = "icons/anchor.tga",
        size     = 5,
        distance = 0.3,
    },
    hshipyard = {
        bitmap   = "icons/anchor2.tga",
        size     = 5,
        distance = 0.3,
    },
    destroyer = {
        bitmap   = "icons/destroyer.tga",
        size     = 5,
        distance = 0.3,
    },
    torpboat = {
        bitmap   = "icons/t-boat.png",
        size     = 4,
        distance = 0.3,
    },
    gunboat = {
        bitmap   = "icons/g-boat.png",
        size     = 4,
        distance = 0.3,
    },
    artyboat = {
        bitmap   = "icons/arty-boat.png",
        size     = 4,
        distance = 0.3,
    },
    turret = {
        --bitmap   = "icons/alert.tga",
        size     = 0, -- should be invisible!
        distance = 0.3,
    },
    landingship = {
        bitmap   = "icons/l-boat.png",
        size     = 4,
        distance = 0.3,
    },
    transportship = {
        bitmap   = "icons/transportship.tga",
        size     = 5,
        distance = 0.3,
    },
    transportplane = {
        bitmap   = "icons/transportplane.tga",
        size     = 2.5,
        distance = 1,
    },
    flametank = {
        bitmap   = "icons/flametank.tga",
        size     = 2.25,
        distance = 0.2,
    },
}

-- Let's append more factions as an extension
Spring.Log('icontypes', 'info', "Loading icons...")
local IconFiles = VFS.DirList("gamedata/icon_types", "*.lua")
Spring.Log('icontypes', 'info', "Found "..#IconFiles.." tables")
-- then add their contents to the main table
for _, IconFile in pairs(IconFiles) do
    Spring.Log('icontypes', 'info', " - Processing "..IconFile)
    local tmpTable = VFS.Include(IconFile)
    if tmpTable then
        for k,v in pairs(tmpTable) do
            iconTypes[k] = v
            Spring.Log('icontypes', 'info', " -- Added ".. k .." icon")
        end
        tmpTable = nil
    end
end

return iconTypes
