print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local pricefischmehl = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local fischmehlHudFile = "Paletten/hud_fill_fischmehl.dds"
	local fischmehlHudFileSmall = "Paletten/hud_fill_fischmehl_sml.dds"
	
    local fischmehlFilType = g_fillTypeManager:addFillType("FISCHMEHL", g_i18n:getText("fischmehl"), true, pricefischmehl * 2.1, 0.00045, math.rad(10), fischmehlHudFile, fischmehlHudFileSmall,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 hasfischmehl=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	hasfischmehl=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "FISCHMEHL" then
		hasfischmehl=true
	end;
		
end;

		if hasmaize and not hasfischmehl then
		local filltypen = g_fillTypeManager:getFillTypeIndexByName("FISCHMEHL")
		local price = g_fillTypeManager:getFillTypeByName("FISCHMEHL").pricePerLiter
			object:addAcceptedFillType(filltypen,price,true,false)
			object.priceMultipliers[ g_fillTypeManager:getFillTypeIndexByName("FISCHMEHL")]=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)