print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local priceflower = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local flowerHudFile = "Paletten/hud_fill_flower.dds"
	local flowerHudFileSmall = "Paletten/hud_fill_flower_smal.dds"
	
    local flowerFilType = g_fillTypeManager:addFillType("FLOWER", g_i18n:getText("flower"), true, priceflower * 0.5, 0.00045, math.rad(10), flowerHudFile, flowerHudFileSmall,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 hasflower=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	hasflower=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "FLOWER" then
		hasflower=true
	end;
		
end;

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