-- by "Marhu" 
-- v 1.0
-- Date: 10.05.2013
RegFillTypes = {};
RegFillTypes.dir = g_currentModDirectory
RegFillTypes.t = {};

local HudDir = "Hud/"

table.insert(RegFillTypes.t, { name="beef", price=0.1, Eco=true, hud=HudDir.."beef/beefHUD"});
table.insert(RegFillTypes.t, { name="pig", price=0.1, Eco=true, hud=HudDir.."pig/pigHUD"});


local org_FSBaseMission_loadMap = FSBaseMission.loadMap
FSBaseMission.loadMap = function(a, b, c, d, e)
	if a.baseDirectory == RegFillTypes.dir or true then
		RegFillTypes.MapName = a.missionInfo.map.title;
		local fill={}
		for i=1, table.getn(RegFillTypes.t) do
			local t = RegFillTypes.t[i];
			local HudFile = RegFillTypes.dir..t.hud..".dds";
			local I18N = t.I18N
			if I18N == nil then
				if g_i18n:hasText(t.name) then
					I18N = g_i18n:getText(t.name);
				else
					I18N = t.name;
				end;
			end;
			local FillType = Fillable.registerFillType(t.name,I18N,t.price,t.Eco,HudFile);
			if Fillable.fillTypeIndexToDesc[FillType] and Fillable.fillTypeIndexToDesc[FillType].nameI18N then
				FSBaseMission.addFillTypeOverlay(a,FillType,HudFile)
				table.insert(fill,Fillable.fillTypeIndexToDesc[FillType].nameI18N);
			else
				table.insert(fill,t.name.." not nameI18N");
			end;
		end;

		local types = RegFillTypes.MapName..": Register Fill type: ";
		for k, v in pairs(fill) do
			types = types..v..", ";
		end;
	end;		
	ra,rb,rc,rd,re = org_FSBaseMission_loadMap(a, b, c, d, e)
	return ra,rb,rc,rd,re 
end;