require 'Scripts/safe_load.lua'

function parseNeighbourhood(neighbourhoodDefinition)
	local neighbourhood = NeighbourhoodData:create(neighbourhoodDefinition.key);

    neighbourhood:setImagePath(neighbourhoodDefinition.imagePath);
    neighbourhood:setMapPosition(neighbourhoodDefinition.mapPosition);
    neighbourhood:setOrder(neighbourhoodDefinition.order);
    neighbourhood:setSoundKey(neighbourhoodDefinition.soundKey);
    neighbourhood:setZOrder(neighbourhoodDefinition.zOrder);

	return neighbourhood;
end

local levels = CCArray:create();

local neighbourhoodDefinitions = loadFileSafe("Scripts/Data/neighbourhoods.lua", {ccc3=ccc3, ccp=ccp});
for key, neighbourhoodDefinition in pairs(neighbourhoodDefinitions) do
    levels:addObject(parseNeighbourhood(neighbourhoodDefinition));
end

return levels;