print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local priceplum = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local plumHudFile = "Paletten/hud_fill_plum.dds"
	local plumHudFileSmall = "Paletten/hud_fill_plum_small.dds"
	
    local plumFilType = g_fillTypeManager:addFillType("PLUM", g_i18n:getText("plum"), true, priceplum * 1.0, 0.00045, math.rad(10), plumHudFile, plumHudFileSmall,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 hasplum=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	hasplum=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "PLUM" then
		hasplum=true
	end;
		
end;

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