print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local priceorange = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local orangeHudFile = "Paletten/hud_fill_orange.dds"
	local orangeHudFileSmall = "Paletten/hud_fill_orange_small.dds"
	
    local orangeFilType = g_fillTypeManager:addFillType("ORANGE", g_i18n:getText("orange"), true, priceorange * 0.9, 0.00045, math.rad(10), orangeHudFile, orangeHudFileSmall,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 hasorange=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	hasorange=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "ORANGE" then
		hasorange=true
	end;
		
end;

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