print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local pricesalat = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local salatHudFile = "Paletten/hud_fill_salat.dds"
	local salatHudFileSmall = "Paletten/hud_fill_salat_smal.dds"
	
    local salatFilType = g_fillTypeManager:addFillType("SALAT", g_i18n:getText("salat"), true, pricesalat * 0.8, 0.00045, math.rad(10), salatHudFile, salatHudFileSmall,modDirectory, nil, { 1, 1, 1 }, nil, false)
	
	g_currentMission.hud.fillLevelsDisplay:refreshFillTypes(g_fillTypeManager)
	end;
end;

function load(id, xmlFile, key,customEnvironment)
	local hasmaize =false
	local hassalat=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	hassalat=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "SALAT" then
		hassalat=true
	end;
		
end;

		if hasmaize and not hassalat then
		local filltypen = g_fillTypeManager:getFillTypeIndexByName("SALAT")
		local price = g_fillTypeManager:getFillTypeByName("SALAT").pricePerLiter
			object:addAcceptedFillType(filltypen,price,true,false)
			object.priceMultipliers[ g_fillTypeManager:getFillTypeIndexByName("SALAT")]=object.priceMultipliers[ g_fillTypeManager:getFillTypeIndexByName("MAIZE")]
			object:initPricingDynamics()
		end;
		
	end;
end;

FSBaseMission.loadMapFinished = Utils.prependedFunction(FSBaseMission.loadMapFinished, onLoadMapFinished)
SellingStation.load = Utils.appendedFunction(SellingStation.load, load)