Index: binaries/data/mods/public/globalscripts/Templates.js
===================================================================
--- binaries/data/mods/public/globalscripts/Templates.js
+++ binaries/data/mods/public/globalscripts/Templates.js
@@ -251,6 +251,7 @@ function GetTemplateDataHelper(template, player)
 			"templates": {
 				"tower": template.WallSet.Templates.Tower,
 				"gate": template.WallSet.Templates.Gate,
+				"fort": template.WallSet.Templates.Fort || "structures/{civ}_fortress",
 				"long": template.WallSet.Templates.WallLong,
 				"medium": template.WallSet.Templates.WallMedium,
 				"short": template.WallSet.Templates.WallShort,
@@ -258,10 +259,21 @@ function GetTemplateDataHelper(template, player)
 			"maxTowerOverlap": +template.WallSet.MaxTowerOverlap,
 			"minTowerOverlap": +template.WallSet.MinTowerOverlap,
 		};
+		if (template.WallSet.Templates.WallEnd)
+			ret.wallSet.templates.end = template.WallSet.Templates.WallEnd;
+		if (template.WallSet.Templates.WallCurveQuarter)
+			ret.wallSet.templates.quarterCurve = template.WallSet.Templates.WallCurveQuarter;
+		if (template.WallSet.Templates.WallCurveEighth)
+			ret.wallSet.templates.eighthCurve = template.WallSet.Templates.WallCurveEighth;
 	}
 
 	if (template.WallPiece)
-		ret.wallPiece = {"length": +template.WallPiece.Length};
+		ret.wallPiece = {
+			"length": +template.WallPiece.Length,
+			"angle": +(template.WallPiece.Orientation || 1) * Math.PI,
+			"indent": +(template.WallPiece.Indent || 0),
+			"bend": +(template.WallPiece.Bend || 0) * Math.PI,
+		};
 
 	return ret;
 }
Index: binaries/data/mods/public/maps/random/belgian_uplands.js
===================================================================
--- binaries/data/mods/public/maps/random/belgian_uplands.js
+++ binaries/data/mods/public/maps/random/belgian_uplands.js
@@ -21,10 +21,6 @@ var mapSize = getMapSize();
 // Heightmap functionality
 //////////
 
-// Some general heightmap settings
-const MIN_HEIGHT = - SEA_LEVEL; // 20, should be set in the libs!
-const MAX_HEIGHT = 0xFFFF/HEIGHT_UNITS_PER_METRE - SEA_LEVEL; // A bit smaler than 90, should be set in the libs!
-
 // Add random heightmap generation functionality
 function getRandomReliefmap(minHeight, maxHeight)
 {
@@ -35,10 +31,10 @@ function getRandomReliefmap(minHeight, maxHeight)
 	if (maxHeight > MAX_HEIGHT)
 		warn("getRandomReliefmap: Argument maxHeight is smaler then the supported maximum height of " + MAX_HEIGHT + " (const MAX_HEIGHT): " + maxHeight)
 	var reliefmap = [];
-	for (var x = 0; x <= mapSize; x++)
+	for (var x = 0; x <= mapSize; ++x)
 	{
 		reliefmap.push([]);
-		for (var y = 0; y <= mapSize; y++)
+		for (var y = 0; y <= mapSize; ++y)
 		{
 			reliefmap[x].push(randFloat(minHeight, maxHeight));
 		}
@@ -50,9 +46,9 @@ function getRandomReliefmap(minHeight, maxHeight)
 function setReliefmap(reliefmap)
 {
 	// g_Map.height = reliefmap;
-	for (var x = 0; x <= mapSize; x++)
+	for (var x = 0; x <= mapSize; ++x)
 	{
-		for (var y = 0; y <= mapSize; y++)
+		for (var y = 0; y <= mapSize; ++y)
 		{
 			setHeight(x, y, reliefmap[x][y]);
 		}
@@ -65,9 +61,9 @@ function getMinAndMaxHeight(reliefmap)
 	var height = {};
 	height.min = Infinity;
 	height.max = -Infinity;
-	for (var x = 0; x <= mapSize; x++)
+	for (var x = 0; x <= mapSize; ++x)
 	{
-		for (var y = 0; y <= mapSize; y++)
+		for (var y = 0; y <= mapSize; ++y)
 		{
 			if (reliefmap[x][y] < height.min)
 				height.min = reliefmap[x][y];
@@ -89,9 +85,9 @@ function getRescaledReliefmap(reliefmap, minHeight, maxHeight)
 	if (maxHeight > MAX_HEIGHT)
 		warn("getRescaledReliefmap: Argument maxHeight is smaler then the supported maximum height of " + MAX_HEIGHT + " (const MAX_HEIGHT): " + maxHeight)
 	var oldHeightRange = getMinAndMaxHeight(reliefmap);
-	for (var x = 0; x <= mapSize; x++)
+	for (var x = 0; x <= mapSize; ++x)
 	{
-		for (var y = 0; y <= mapSize; y++)
+		for (var y = 0; y <= mapSize; ++y)
 		{
 			newReliefmap[x][y] = minHeight + (reliefmap[x][y] - oldHeightRange.min) / (oldHeightRange.max - oldHeightRange.min) * (maxHeight - minHeight);
 		}
@@ -105,12 +101,12 @@ function getHeightErrosionedReliefmap(reliefmap, strength)
 	var newReliefmap = deepcopy(reliefmap);
 	strength = (strength || 1.0); // Values much higher then 1 (1.32+ for an 8 tile map, 1.45+ for a 12 tile map, 1.62+ @ 20 tile map, 0.99 @ 4 tiles) will result in a resonance disaster/self interference
 	var map = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]; // Default
-	for (var x = 0; x <= mapSize; x++)
+	for (var x = 0; x <= mapSize; ++x)
 	{
-		for (var y = 0; y <= mapSize; y++)
+		for (var y = 0; y <= mapSize; ++y)
 		{
 			var div = 0;
-			for (var i = 0; i < map.length; i++)
+			for (var i = 0; i < map.length; ++i)
 				newReliefmap[x][y] += strength / map.length * (reliefmap[(x + map[i][0] + mapSize + 1) % (mapSize + 1)][(y + map[i][1] + mapSize + 1) % (mapSize + 1)] - reliefmap[x][y]); // Not entirely sure if scaling with map.length is perfect but tested values seam to indicate it is
 		}
 	}
@@ -173,7 +169,7 @@ var terreins = ["temp_grass_plants|gaia/flora_tree_euro_beech", "temp_grass_moss
 	"temp_grass_long|gaia/flora_tree_apple", "temp_grass_clovers|gaia/flora_bush_berry", "temp_grass_clovers_2|gaia/flora_bush_grapes",
 	"temp_grass_plants|gaia/fauna_deer", "temp_grass_long_b|gaia/fauna_rabbit"];
 var numTerreins = terreins.length;
-for (var i = 0; i < numTerreins; i++)
+for (var i = 0; i < numTerreins; ++i)
 	terreins.push("temp_grass_plants");
 textueByHeight.push({"upperHeightLimit": waterHeightAdjusted + 5/6 * (heightRange.max - waterHeightAdjusted), "terrain": terreins});
 // Unpassable woods
@@ -200,11 +196,11 @@ var enoughTiles = false;
 var tries = 0;
 while (!goodStartPositionsFound)
 {
-	tries++;
+	++tries;
 	log("Starting giant while loop try " + tries);
 	// Generate reliefmap
 	var myReliefmap = getRandomReliefmap(heightRange.min, heightRange.max);
-	for (var i = 0; i < 50 + mapSize/4; i++) // Cycles depend on mapsize (more cycles -> bigger structures)
+	for (var i = 0; i < 50 + mapSize/4; ++i) // Cycles depend on mapsize (more cycles -> bigger structures)
 		myReliefmap = getHeightErrosionedReliefmap(myReliefmap, 1);
 	myReliefmap = getRescaledReliefmap(myReliefmap, heightRange.min, heightRange.max);
 	setReliefmap(myReliefmap);
@@ -217,18 +213,18 @@ while (!goodStartPositionsFound)
 	var lowerHeightLimit = textueByHeight[3].upperHeightLimit;
 	var upperHeightLimit = textueByHeight[6].upperHeightLimit;
 	// Check for valid points by height
-	for (var x = distToBorder + minTerrainDistToBorder; x < mapSize - distToBorder - minTerrainDistToBorder; x++)
+	for (var x = distToBorder + minTerrainDistToBorder; x < mapSize - distToBorder - minTerrainDistToBorder; ++x)
 	{
-		for (var y = distToBorder + minTerrainDistToBorder; y < mapSize - distToBorder - minTerrainDistToBorder; y++)
+		for (var y = distToBorder + minTerrainDistToBorder; y < mapSize - distToBorder - minTerrainDistToBorder; ++y)
 		{
 			var actualHeight = getHeight(x, y);
 			if (actualHeight > lowerHeightLimit && actualHeight < upperHeightLimit)
 			{
 				// Check for points within a valid area by height (rectangular since faster)
 				var isPossible = true;
-				for (var offX = - neededDistance; offX <= neededDistance; offX++)
+				for (var offX = - neededDistance; offX <= neededDistance; ++offX)
 				{
-					for (var offY = - neededDistance; offY <= neededDistance; offY++)
+					for (var offY = - neededDistance; offY <= neededDistance; ++offY)
 					{
 						var testHeight = getHeight(x + offX, y + offY);
 						if (testHeight <= lowerHeightLimit || testHeight >= upperHeightLimit)
@@ -252,7 +248,7 @@ while (!goodStartPositionsFound)
 	// Reduce to tiles in a circle of mapSize / 2 distance to the center (to avoid players placed in corners)
 	var possibleStartPositionsTemp = [];
 	var maxDistToCenter = mapSize / 2;
-	for (var i = 0; i < possibleStartPositions.length; i++)
+	for (var i = 0; i < possibleStartPositions.length; ++i)
 	{
 		var deltaX = possibleStartPositions[i][0] - mapSize / 2;
 		var deltaY = possibleStartPositions[i][1] - mapSize / 2;
@@ -270,19 +266,19 @@ while (!goodStartPositionsFound)
 	var maxDistToResources = distToBorder; // Has to be <= distToBorder!
 	var minNumLowTiles = 10;
 	var minNumHighTiles = 10;
-	for (var i = 0; i < possibleStartPositions.length; i++)
+	for (var i = 0; i < possibleStartPositions.length; ++i)
 	{
 		var numLowTiles = 0;
 		var numHighTiles = 0;
-		for (var dx = - maxDistToResources; dx < maxDistToResources; dx++)
+		for (var dx = - maxDistToResources; dx < maxDistToResources; ++dx)
 		{
-			for (var dy = - maxDistToResources; dy < maxDistToResources; dy++)
+			for (var dy = - maxDistToResources; dy < maxDistToResources; ++dy)
 			{
 				var testHeight = getHeight(possibleStartPositions[i][0] + dx, possibleStartPositions[i][1] + dy);
 				if (testHeight < lowerHeightLimit)
-					numLowTiles++;
+					++numLowTiles;
 				if (testHeight > upperHeightLimit)
-					numHighTiles++;
+					++numHighTiles;
 				if (numLowTiles > minNumLowTiles && numHighTiles > minNumHighTiles)
 					break;
 			}
@@ -311,22 +307,22 @@ while (!goodStartPositionsFound)
 		// Get some random start location derivations. NOTE: Itterating over all possible derivations is just to much (valid points ** numPlayers)
 		var maxTries = 100000; // floor(800000 / (Math.pow(numPlayers, 2) / 2));
 		var possibleDerivations = [];
-		for (var i = 0; i < maxTries; i++)
+		for (var i = 0; i < maxTries; ++i)
 		{
 			var vector = [];
-			for (var p = 0; p < numPlayers; p++)
+			for (var p = 0; p < numPlayers; ++p)
 				vector.push(randInt(possibleStartPositions.length));
 			possibleDerivations.push(vector);
 		}
 		
 		// Choose the start location derivation with the greatest minimum distance between players
 		var maxMinDist = 0;
-		for (var d = 0; d < possibleDerivations.length; d++)
+		for (var d = 0; d < possibleDerivations.length; ++d)
 		{
 			var minDist = 2 * mapSize;
-			for (var p1 = 0; p1 < numPlayers - 1; p1++)
+			for (var p1 = 0; p1 < numPlayers - 1; ++p1)
 			{
-				for (var p2 = p1 + 1; p2 < numPlayers; p2++)
+				for (var p2 = p1 + 1; p2 < numPlayers; ++p2)
 				{
 					if (p1 != p2)
 					{
@@ -372,12 +368,12 @@ if (mapSize > 500)
 	propDensity = 1/4;
 else if (mapSize > 400)
 	propDensity = 3/4;
-for(var x = minTerrainDistToBorder; x < mapSize - minTerrainDistToBorder; x++)
+for(var x = minTerrainDistToBorder; x < mapSize - minTerrainDistToBorder; ++x)
 {
-	for (var y = minTerrainDistToBorder; y < mapSize - minTerrainDistToBorder; y++)
+	for (var y = minTerrainDistToBorder; y < mapSize - minTerrainDistToBorder; ++y)
 	{
 		var textureMinHeight = heightRange.min;
-		for (var i = 0; i < textueByHeight.length; i++)
+		for (var i = 0; i < textueByHeight.length; ++i)
 		{
 			if (getHeight(x, y) >= textureMinHeight && getHeight(x, y) <= textueByHeight[i].upperHeightLimit)
 			{
@@ -497,7 +493,7 @@ RMS.SetProgress(90);
 // Place players and start resources
 ////////
 
-for (var p = 0; p < numPlayers; p++)
+for (var p = 0; p < numPlayers; ++p)
 {
 	var actualX = possibleStartPositions[bestDerivation[p]][0];
 	var actualY = possibleStartPositions[bestDerivation[p]][1];
@@ -509,7 +505,7 @@ for (var p = 0; p < numPlayers; p++)
 	{
 		var uAngle = BUILDING_ANGlE - PI * (2-j) / 2;
 		var count = 4;
-		for (var numberofentities = 0; numberofentities < count; numberofentities++)
+		for (var numberofentities = 0; numberofentities < count; ++numberofentities)
 		{
 			var ux = actualX + uDist * cos(uAngle) + numberofentities * uSpace * cos(uAngle + PI/2) - (0.75 * uSpace * floor(count / 2) * cos(uAngle + PI/2));
 			var uz = actualY + uDist * sin(uAngle) + numberofentities * uSpace * sin(uAngle + PI/2) - (0.75 * uSpace * floor(count / 2) * sin(uAngle + PI/2));
@@ -531,7 +527,7 @@ timeArray.push(new Date().getTime());
 // Calculate progress percentage with the time checks
 var generationTime = timeArray[timeArray.length - 1] - timeArray[0];
 log("Total generation time (ms): " + generationTime);
-for (var i = 0; i < timeArray.length; i++)
+for (var i = 0; i < timeArray.length; ++i)
 {
 	var timeSinceStart = timeArray[i] - timeArray[0];
 	var progressPercentage = 100 * timeSinceStart / generationTime;
Index: binaries/data/mods/public/maps/random/rmgen/library.js
===================================================================
--- binaries/data/mods/public/maps/random/rmgen/library.js
+++ binaries/data/mods/public/maps/random/rmgen/library.js
@@ -4,14 +4,24 @@
 /////////////////////////////////////////////////////////////////////////////////////////////
 
 const PI = Math.PI;
-const TWO_PI = 2 * Math.PI;
+const TWO_PI = 2 * Math.PI; // mathematically known as 'tau'
 const TERRAIN_SEPARATOR = "|";
-const SEA_LEVEL = 20.0;
+const SEA_LEVEL = 160.0;
 const CELL_SIZE = 4;
 const HEIGHT_UNITS_PER_METRE = 92;
 const MIN_MAP_SIZE = 128;
 const MAX_MAP_SIZE = 512;
 const FALLBACK_CIV = "athen";
+// Constants needed for heightmap_manipulation.js
+const MAX_HEIGHT_RANGE = 0xFFFF / HEIGHT_UNITS_PER_METRE // Engine limit, Roughly 700 meters
+const MIN_HEIGHT = - SEA_LEVEL;
+const MAX_HEIGHT = MAX_HEIGHT_RANGE - SEA_LEVEL;
+// Entity template structure keys that might change, for easier mod support
+const STARTING_ENTITY_KEY = "StartEntities";
+const START_ENTITY_TEMPLATE_PATH_KEY = "Template"
+const BUILDER_TEMPLATEPATH_KEYS = ["Builder", "Entities", "_string"];
+const PRODUCTION_TEMPLATEPATH_KEYS = ["ProductionQueue", "Entities", "_string"];
+const CIV_PLACEHOLDER_STRING = "{civ}";
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 //	Utility functions
@@ -103,7 +113,7 @@ function argsToArray(x)
 	if (numArgs != 1)
 	{
 		var ret = new Array(numArgs);
-		for (var i=0; i < numArgs; i++)
+		for (var i=0; i < numArgs; ++i)
 		{
 			ret[i] = x[i];
 		}
@@ -132,7 +142,7 @@ function shuffleArray(source)
 		return [];
 
 	var result = [source[0]];
-	for (var i = 1; i < source.length; i++)
+	for (var i = 1; i < source.length; ++i)
 	{
 		var j = randInt(0, i);
 		result[i] = result[j];
@@ -172,12 +182,12 @@ function createAreas(centeredPlacer, painter, constraint, num, retryFactor)
 		var area = g_Map.createArea(centeredPlacer, painter, constraint);
 		if (area !== undefined)
 		{
-			good++;
+			++good;
 			result.push(area);
 		}
 		else
 		{
-			bad++;
+			++bad;
 		}
 	}
 	return result;
@@ -208,12 +218,12 @@ function createAreasInAreas(centeredPlacer, painter, constraint, num, retryFacto
 		var area = g_Map.createArea(centeredPlacer, painter, constraint);
 		if (area !== undefined)
 		{
-			good++;
+			++good;
 			result.push(area);
 		}
 		else
 		{
-			bad++;
+			++bad;
 		}
 	}
 	return result;
@@ -248,11 +258,11 @@ function createObjectGroups(placer, player, constraint, num, retryFactor)
 		var result = createObjectGroup(placer, player, constraint);
 		if (result !== undefined)
 		{
-			good++;
+			++good;
 		}
 		else
 		{
-			bad++;
+			++bad;
 		}
 	}
 	return good;
@@ -282,11 +292,11 @@ function createObjectGroupsByAreas(placer, player, constraint, num, retryFactor,
 		var result = createObjectGroup(placer, player, constraint);
 		if (result !== undefined)
 		{
-			good++;
+			++good;
 		}
 		else
 		{
-			bad++;
+			++bad;
 		}
 	}
 	return good;
@@ -394,15 +404,111 @@ function getNumPlayers()
 	return g_MapSettings.PlayerData.length - 1;
 }
 
+// Takes nothing, returns an array of strings representing all available civilizations
+function getCivList()
+{
+	var raw_civData = RMS.GetCivData();
+	var civList = [];
+	for (var i = 0; i < raw_civData.length; ++i)
+		civList.push(JSON.parse(raw_civData[i]).Code);
+	
+	return civList;
+}
+
+// Takes nothing, returns an associative array with civ strings as keys containing all unpacked civ data (Templates need to be unpacked with RMS.GetTemplate() if needed)
+function getFullCivData()
+{
+	var rawCivData = RMS.GetCivData();
+	var unpackedCivData = {};
+	for (var i = 0; i < rawCivData.length; ++i)
+	{
+		var singleCivData = JSON.parse(rawCivData[i]);
+		unpackedCivData[singleCivData.Code] = singleCivData;
+	}
+	
+	return unpackedCivData;
+}
+
+// Takes a player number (0-7, so Gaia excluded). Returns this players civ string
+// ToDo: If the player number is to high an error will occur (and the fallback won't be reached)!
 function getCivCode(player)
 {
 	if (g_MapSettings.PlayerData[player+1].Civ)
 		return g_MapSettings.PlayerData[player+1].Civ;
 
-	warn("undefined civ specified for player " + (player + 1) + ", falling back to '" + FALLBACK_CIV + "'");
+	warn("Undefined civ specified for player " + (player + 1) + ", falling back to '" + FALLBACK_CIV + "'");
 	return FALLBACK_CIV;
 }
 
+// Takes an entity path and a key list to get the templates value
+function getTemplateValue(entPath, key_list)
+{
+	var subdata = RMS.GetTemplate(entPath);
+	for (var i = 0; i < key_list.length; ++i)
+	{
+		if (!subdata[key_list[i]])
+			{return false};
+		subdata = subdata[key_list[i]];
+	}
+	return subdata;
+}
+
+// Returns a list of all templates paths available to the given civ
+function getTempatePathList(civ)
+{
+	var templatePaths = getFullCivData();
+	if (!templatePaths[civ])
+	{
+		warn("getTempatePathList: Unknown civ '" + civ + "' not in " + Object.keys(templatePaths));
+		return false;
+	}
+	templatePaths = templatePaths[civ];
+	
+	if (!templatePaths[STARTING_ENTITY_KEY])
+	{
+		warn("getTempatePathList: Civ has no starting entities as defined in STARTING_ENTITY_KEY (" + STARTING_ENTITY_KEY + "): " + Object.keys(templatePaths));
+		return false;
+	}
+	templatePaths = templatePaths[STARTING_ENTITY_KEY];
+	
+	for (var i = 0; i < templatePaths.length; ++i)
+	{
+		if (!templatePaths[i][START_ENTITY_TEMPLATE_PATH_KEY])
+		{
+			warn("getTempatePathList: Starting entity list item has no template as defined in START_ENTITY_TEMPLATE_PATH_KEY (" + START_ENTITY_TEMPLATE_PATH_KEY + "): " + Object.keys(templatePaths));
+			return false;
+		}
+		templatePaths[i] = templatePaths[i][START_ENTITY_TEMPLATE_PATH_KEY];
+	}
+	var foundNew = 1;
+	while (foundNew > 0)
+	{
+		foundNew = 0;
+		var methods = [BUILDER_TEMPLATEPATH_KEYS, PRODUCTION_TEMPLATEPATH_KEYS];
+		for (var m = 0; m < methods.length; ++m)
+		{
+			for (var t = 0; t < templatePaths.length; ++t)
+			{
+				var pathsToCheck = getTemplateValue(templatePaths[t], methods[m]);
+				if (typeof(pathsToCheck) === typeof(""))
+				{
+					pathsToCheck = pathsToCheck.split(/\s+/);
+					for (var c = 0; c < pathsToCheck.length; ++c)
+					{
+						var actualPath = pathsToCheck[c].replace(CIV_PLACEHOLDER_STRING, civ);
+						if (templatePaths.indexOf(actualPath) == -1 && RMS.TemplateExists(actualPath))
+						{
+							templatePaths.push(actualPath);
+							++foundNew;
+						}
+					}
+				}
+			}
+		}
+	}
+	return templatePaths;
+}
+
 function areAllies(player1, player2)
 {
 	if ((g_MapSettings.PlayerData[player1+1].Team === undefined) || (g_MapSettings.PlayerData[player2+1].Team === undefined) || (g_MapSettings.PlayerData[player2+1].Team == -1) || (g_MapSettings.PlayerData[player1+1].Team == -1))
@@ -434,14 +540,14 @@ function sortPlayers(source)
 
 	var result = new Array(0);
 	var team = new Array(5);
-	for (var q = 0; q < 5; q++)
+	for (var q = 0; q < 5; ++q)
 	{
 		team[q] = new Array(1);
 	}
 
-	for (var i = -1; i < 4; i++)
+	for (var i = -1; i < 4; ++i)
 	{
-		for (var j = 0; j < source.length; j++)
+		for (var j = 0; j < source.length; ++j)
 		{
 			if (getPlayerTeam(j) == i)
 			{
@@ -461,7 +567,7 @@ function primeSortPlayers(source)
 
 	var prime = new Array(source.length);
 
-	for (var i = 0; i < round(source.length/2); i++)
+	for (var i = 0; i < round(source.length/2); ++i)
 	{
 		prime[2*i]=source[i];
 		prime[2*i+1]=source[source.length-1-i];
@@ -535,7 +641,7 @@ function unPaintClass(id)
 function avoidClasses(/*class1, dist1, class2, dist2, etc*/)
 {
 	var ar = new Array(arguments.length/2);
-	for (var i = 0; i < arguments.length/2; i++)
+	for (var i = 0; i < arguments.length/2; ++i)
 	{
 		ar[i] = new AvoidTileClassConstraint(arguments[2*i], arguments[2*i+1]);
 	}
@@ -555,7 +661,7 @@ function avoidClasses(/*class1, dist1, class2, dist2, etc*/)
 function stayClasses(/*class1, dist1, class2, dist2, etc*/)
 {
 	var ar = new Array(arguments.length/2);
-	for (var i = 0; i < arguments.length/2; i++)
+	for (var i = 0; i < arguments.length/2; ++i)
 	{
 		ar[i] = new StayInTileClassConstraint(arguments[2*i], arguments[2*i+1]);
 	}
@@ -575,7 +681,7 @@ function stayClasses(/*class1, dist1, class2, dist2, etc*/)
 function borderClasses(/*class1, idist1, odist1, class2, idist2, odist2, etc*/)
 {
 	var ar = new Array(arguments.length/3);
-	for (var i = 0; i < arguments.length/3; i++)
+	for (var i = 0; i < arguments.length/3; ++i)
 	{
 		ar[i] = new BorderTileClassConstraint(arguments[3*i], arguments[3*i+1], arguments[3*i+2]);
 	}
@@ -642,4 +748,3 @@ function getTerrainTexture(x, y)
 {
 	return g_Map.getTexture(x, y);
 }
-
Index: binaries/data/mods/public/maps/random/rmgen/misc.js
===================================================================
--- binaries/data/mods/public/maps/random/rmgen/misc.js
+++ binaries/data/mods/public/maps/random/rmgen/misc.js
@@ -20,9 +20,9 @@ function passageMaker(x1, z1, x2, z2, width, maxheight, height, smooth, tileclas
 	var tchm = TILE_CENTERED_HEIGHT_MAP;
 	TILE_CENTERED_HEIGHT_MAP = true;
 	var mapSize = g_Map.size;
-	for (var ix = 0; ix < mapSize; ix++)
+	for (var ix = 0; ix < mapSize; ++ix)
 	{
-		for (var iz = 0; iz < mapSize; iz++)
+		for (var iz = 0; iz < mapSize; ++iz)
 		{
 			var a = z1-z2;
 			var b = x2-x1;
@@ -92,7 +92,7 @@ function rndRiver(f, seed)
 	var rndRe = 0;
 	var rndRr = f-floor(f);
 	var rndRa = 0;
-	for (var rndRx=0; rndRx<=floor(f); rndRx++)
+	for (var rndRx=0; rndRx<=floor(f); ++rndRx)
 	{
 		rndRw = 10*(rndRw-floor(rndRw));
 	}
@@ -148,7 +148,7 @@ function createStartingPlayerEntities(fx, fz, playerid, civEntities, BUILDING_AN
 	{
 		var uAngle = BUILDING_ANGlE - PI * (2-j) / 2;
 		var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1);
-		for (var numberofentities = 0; numberofentities < count; numberofentities++)
+		for (var numberofentities = 0; numberofentities < count; ++numberofentities)
 		{
 			var ux = fx + uDist * cos(uAngle) + numberofentities * uSpace * cos(uAngle + PI/2) - (0.75 * uSpace * floor(count / 2) * cos(uAngle + PI/2));
 			var uz = fz + uDist * sin(uAngle) + numberofentities * uSpace * sin(uAngle + PI/2) - (0.75 * uSpace * floor(count / 2) * sin(uAngle + PI/2));
@@ -157,17 +157,17 @@ function createStartingPlayerEntities(fx, fz, playerid, civEntities, BUILDING_AN
 	}
 }
 
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // placeCivDefaultEntities
 //
 //	Creates the default starting player entities depending on the players civ
 //	fx&fy: position of player base
 //	playerid: id of player
 //	angle: angle of main base building, optional, default is BUILDING_ANGlE
-//	kwargs: Takes some optional keyword arguments to tweek things
-//		'iberWall': may be false, 'walls' (default) or 'towers'. Determines the defensive structures Iberians get as civ bonus
+//	kwargs: Optional. Takes an associative array with keyword arguments to tweak things:
+//		Known keys: 'iberWall': may be false, 'walls' (default) or 'towers'. Determines the defensive structures Iberians get as civ bonus
 //
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 function placeCivDefaultEntities(fx, fz, playerid, angle, kwargs)
 {
 	// Unpack kwargs
@@ -187,7 +187,7 @@ function placeCivDefaultEntities(fx, fz, playerid, angle, kwargs)
 	{
 		var uAngle = angle - PI * (2-j) / 2;
 		var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1);
-		for (var numberofentities = 0; numberofentities < count; numberofentities++)
+		for (var numberofentities = 0; numberofentities < count; ++numberofentities)
 		{
 			var ux = fx + uDist * cos(uAngle) + numberofentities * uSpace * cos(uAngle + PI/2) - (0.75 * uSpace * floor(count / 2) * cos(uAngle + PI/2));
 			var uz = fz + uDist * sin(uAngle) + numberofentities * uSpace * sin(uAngle + PI/2) - (0.75 * uSpace * floor(count / 2) * sin(uAngle + PI/2));
@@ -221,9 +221,9 @@ function placeCivDefaultEntities(fx, fz, playerid, angle, kwargs)
 function paintTerrainBasedOnHeight(minheight, maxheight, mode, terrain)
 {
 	var mSize = g_Map.size;
-	for (var qx = 0; qx < mSize; qx++)
+	for (var qx = 0; qx < mSize; ++qx)
 	{
-		for (var qz = 0; qz < mSize; qz++)
+		for (var qz = 0; qz < mSize; ++qz)
 		{
 			if (mode == 0)
 			{
@@ -273,9 +273,9 @@ function paintTerrainBasedOnHeight(minheight, maxheight, mode, terrain)
 function paintTileClassBasedOnHeight(minheight, maxheight, mode, tileclass)
 {
 	var mSize = g_Map.size;
-	for (var qx = 0; qx < mSize; qx++)
+	for (var qx = 0; qx < mSize; ++qx)
 	{
-		for (var qz = 0; qz < mSize; qz++)
+		for (var qz = 0; qz < mSize; ++qz)
 		{
 			if (mode == 0)
 			{
@@ -313,9 +313,9 @@ function paintTileClassBasedOnHeight(minheight, maxheight, mode, tileclass)
 function unPaintTileClassBasedOnHeight(minheight, maxheight, mode, tileclass)
 {
 	var mSize = g_Map.size;
-	for (var qx = 0; qx < mSize; qx++)
+	for (var qx = 0; qx < mSize; ++qx)
 	{
-		for (var qz = 0; qz < mSize; qz++)
+		for (var qz = 0; qz < mSize; ++qz)
 		{
 			if (mode == 0)
 			{
@@ -617,7 +617,7 @@ function createMountain(maxHeight, minRadius, maxRadius, numCircles, constraint,
 		
 		for (var ix = sx; ix <= lx; ++ix)
 		{
-			for (var iz = sz; iz <= lz; ++ iz)
+			for (var iz = sz; iz <= lz; ++iz)
 			{
 				dx = ix - cx;
 				dz = iz - cz;
@@ -666,7 +666,7 @@ function createMountain(maxHeight, minRadius, maxRadius, numCircles, constraint,
 		
 		for (var ix = sx; ix <= lx; ++ix)
 		{
-			for (var iz = sz; iz <= lz; ++ iz)
+			for (var iz = sz; iz <= lz; ++iz)
 			{
 				if (fcc)
 					if ((x - ix) > fcc || (ix - x) > fcc || (z - iz) > fcc || (iz - z) > fcc)
@@ -737,7 +737,7 @@ function createMountain(maxHeight, minRadius, maxRadius, numCircles, constraint,
 		
 		for (var ix = sx; ix <= lx; ++ix)
 		{
-			for (var iz = sz; iz <= lz; ++ iz)
+			for (var iz = sz; iz <= lz; ++iz)
 			{
 				dx = ix - cx;
 				dz = iz - cz;
Index: binaries/data/mods/public/maps/random/rmgen/wall_builder.js
===================================================================
--- binaries/data/mods/public/maps/random/rmgen/wall_builder.js
+++ binaries/data/mods/public/maps/random/rmgen/wall_builder.js
@@ -27,56 +27,48 @@
 //		maxTrys
 // Add treasures to wall style "others"
 // Adjust documentation
-// Perhaps rename "endLeft" to "start" and "endRight" to "end"
-// ?Use available civ-type wall elements rather than palisades: Remove "endLeft" and "endRight" as default wall elements and adjust default palisade fortress types?
-// ?Remove "endRight", "endLeft" and adjust generic fortress types palisades?
-// ?Think of something to enable splitting walls into two walls so more complex walls can be build and roads can have branches/crossroads?
+// ?Use available civ-type wall elements rather than palisades: Remove "end" as a default wall element and adjust default palisade fortress types?
+// ?Adjust generic fortress types palisades?
+// ?Think of something to enable splitting walls into two walls so more complex walls can be built?
 // ?Readjust placement angle for wall elements with bending when used in linear/circular walls by their bending?
 
+/**
+ * Set some globals for this module
+ */
+var g_WallStyles = {};
+var g_WallStyleList = [];
+var g_CivData = getFullCivData();
+var g_CivList = Object.keys(g_CivData);
+var g_FortressTypes = {};
+var g_FortressTypeKeys = ["tiny", "small", "medium", "normal", "large", "veryLarge", "giant"];
 
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//  WallElement class definition
-//
-//	Concept: If placed unrotated the wall's course is towards positive Y (top) with "outside" right (+X) and "inside" left (-X) like unrotated entities has their drop-points right (in rmgen)
-//	The course of the wall will be changed by corners (bending != 0) and so the "inside"/"outside" direction
-//
-//	type    Descriptive string, example: "wallLong". NOTE: Not really needed. Mainly for custom wall elements and to get the wall element type in code
-//	entity  Optional. Template name string of the entity to be placed, example: "structures/cart_wall_long". Default is undefined (No entity placed)
-//	angle   Optional. The angle (float) added to place the entity so "outside" is right when the wall element is placed unrotated. Default is 0
-//	width   Optional. How far this wall element lengthens the wall (float), if unrotated the Y space needed. Default is 0
-//	indent  Optional. The lateral indentation of the entity, drawn "inside" (positive values) or pushed "outside" (negative values). Default is 0
-//	bending Optional. How the course of the wall is changed after this element, positive is bending "in"/left/counter clockwise (like entity placement)
-//		NOTE: Bending is not supported by all placement functions (see there)
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function WallElement(type, entity, angle, width, indent, bending)
+/**
+ * Basic Initialisation
+ * 
+ * Fetches wallsets from {civ}.json files, and then uses them to load
+ * basic wall elements
+ */
+for (let civ of g_CivList)
 {
-	this.type = type;
-	// Default wall element type documentation:
-	// Lengthening straight blocking (mainly left/right symmetric) wall elements (Walls and wall fortifications)
-		// "wall"          A blocking straight wall element that mainly lengthens the wall, self-explanatory
-		// "wallShort"     self-explanatory
-		// "wallLong"      self-explanatory
-		// "tower"         A blocking straight wall element with damage potential (but for palisades) that slightly lengthens the wall, example: wall tower, palisade tower(No attack)
-		// "wallFort"      A blocking straight wall element with massive damage potential that lengthens the wall, example: fortress, palisade fort
-	// Lengthening straight non/custom blocking (mainly left/right symmetric) wall elements (Gates and entries)
-		// "gate"          A blocking straight wall element with passability determined by owner, example: gate (Functionality not yet implemented)
-		// "entry"         A non-blocking straight wall element (same width as gate) but without an actual template or just a flag/column/obelisk
-		// "entryTower"    A non-blocking straight wall element (same width as gate) represented by a single (maybe indented) template, example: defence tower, wall tower, outpost, watchtower
-		// "entryFort"     A non-blocking straight wall element represented by a single (maybe indented) template, example: fortress, palisade fort
-	// Bending wall elements (Wall corners)
-		// "cornerIn"      A wall element bending the wall by PI/2 "inside" (left, +, see above), example: wall tower, palisade curve
-		// "cornerOut"     A wall element bending the wall by PI/2 "outside" (right, -, see above), example: wall tower, palisade curve
-		// "cornerHalfIn"  A wall element bending the wall by PI/4 "inside" (left, +, see above), example: wall tower, palisade curve. NOTE: Not yet implemented
-		// "cornerHalfOut" A wall element bending the wall by PI/4 "outside" (right, -, see above), example: wall tower, palisade curve. NOTE: Not yet implemented
-	// Zero length straight indented (mainly left/right symmetric) wall elements (Outposts/watchtowers and non-defensive base structures)
-		// "outpost"       A zero-length wall element without bending far indented so it stands outside the wall, example: outpost, defence tower, watchtower
-		// "house"         A zero-length wall element without bending far indented so it stands inside the wall that grants population bonus, example: house, hut, longhouse
-		// "barracks"      A zero-length wall element without bending far indented so it stands inside the wall that grants unit production, example: barracks, tavern, ...
-	this.entity = entity;
-	this.angle = (angle !== undefined) ? angle : 0*PI;
-	this.width = (width !== undefined) ? width : 0;
-	this.indent = (indent !== undefined) ? indent : 0;
-	this.bending = (bending !== undefined) ? bending : 0*PI;
+	let civInfo = g_CivData[civ];
+	if (!civInfo.WallSets)
+		continue;
+
+	for (let path of civInfo.WallSets)
+	{
+		let style = path.split("/")[1].split("_");
+		style = (style[0]=="wallset") ? style[1] : style[0]+"_"+style[2];
+
+		if (g_WallStyleList.indexOf(style) == -1)
+		{
+			g_WallStyleList.push(style);
+			g_WallStyles[style] = {};
+			let wallset = GetTemplateDataHelper(RMS.GetTemplate(path)).wallSet;
+			for (let element in wallset.templates)
+				setWallElement(style, element, wallset.templates[element].replace("{civ}",civ))
+			g_WallStyles[style]["@overlap"] = wallset.minTowerOverlap * getWallElement(style, "tower").length;
+		}
+	}
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -86,233 +78,262 @@ function WallElement(type, entity, angle, width, indent, bending)
 //	It's mainly the abstract shape defined in a Fortress instances wall because different styles can be used for it (see wallStyles)
 //
 //	type                  Descriptive string, example: "tiny". Not really needed (WallTool.wallTypes["type string"] is used). Mainly for custom wall elements
-//	wall                  Optional. Array of wall element strings. Can be set afterwards. Default is an epty array.
+//	wall                  Optional. Array of wall element strings. Can be set afterwards. Default is an empty array.
 //		Example: ["entrance", "wall", "cornerIn", "wall", "gate", "wall", "entrance", "wall", "cornerIn", "wall", "gate", "wall", "cornerIn", "wall"]
 //	centerToFirstElement  Optional. Object with properties "x" and "y" representing a vector from the visual center to the first wall element. Default is undefined
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 function Fortress(type, wall, centerToFirstElement)
 {
-	this.type = type; // Only usefull to get the type of the actual fortress
-	this.wall = (wall !== undefined) ? wall : [];
-	this.centerToFirstElement = undefined;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//  wallStyles data structure for default wall styles
-//
-//	A wall style is an associative array with all wall elements of that style in it associated with the wall element type string
-//	wallStyles holds all the wall styles within an associative array with the civ string or another descriptive strings as key
-//	Examples: "athen", "rome_siege", "palisades", "fence", "road"
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-var wallStyles = {};
-
-// Generic civ dependent wall style definition. "rome_siege" needs some tweek...
-var wallScaleByType = {"athen" : 1.5, "brit" : 1.5, "cart" : 1.8, "gaul" : 1.5, "iber" : 1.5, "mace" : 1.5, "maur": 1.5, "pers" : 1.5, "ptol" : 1.5, "rome" : 1.5, "sele" : 1.5, "spart" : 1.5, "rome_siege" : 1.5};
-for (var style in wallScaleByType)
-{
-	var civ = style;
-	if (style == "rome_siege")
-		civ = "rome";
-	wallStyles[style] = {};
-	// Default wall elements
-	wallStyles[style]["tower"] = new WallElement("tower", "structures/" + style + "_wall_tower", PI, wallScaleByType[style]);
-	wallStyles[style]["endLeft"] = new WallElement("endLeft", "structures/" + style + "_wall_tower", PI, wallScaleByType[style]); // Same as tower. To be compatible with palisades...
-	wallStyles[style]["endRight"] = new WallElement("endRight", "structures/" + style + "_wall_tower", PI, wallScaleByType[style]); // Same as tower. To be compatible with palisades...
-	wallStyles[style]["cornerIn"] = new WallElement("cornerIn", "structures/" + style + "_wall_tower", 5*PI/4, 0, 0.35*wallScaleByType[style], PI/2); // 2^0.5 / 4 ~= 0.35 ~= 1/3
-	wallStyles[style]["cornerOut"] = new WallElement("cornerOut", "structures/" + style + "_wall_tower", 3*PI/4, 0.71*wallScaleByType[style], 0, -PI/2); // // 2^0.5 / 2 ~= 0.71 ~= 2/3
-	wallStyles[style]["wallShort"] = new WallElement("wallShort", "structures/" + style + "_wall_short", 0*PI, 2*wallScaleByType[style]);
-	wallStyles[style]["wall"] = new WallElement("wall", "structures/" + style + "_wall_medium", 0*PI, 4*wallScaleByType[style]);
-	wallStyles[style]["wallMedium"] = new WallElement("wall", "structures/" + style + "_wall_medium", 0*PI, 4*wallScaleByType[style]);
-	wallStyles[style]["wallLong"] = new WallElement("wallLong", "structures/" + style + "_wall_long", 0*PI, 6*wallScaleByType[style]);
-	// Gate and entrance wall elements
-	var gateWidth = 6*wallScaleByType[style];
-	wallStyles[style]["gate"] = new WallElement("gate", "structures/" + style + "_wall_gate", PI, gateWidth);
-	wallStyles[style]["entry"] = new WallElement("entry", undefined, 0*PI, gateWidth);
-	wallStyles[style]["entryTower"] = new WallElement("entryTower", "structures/" + civ + "_defense_tower", PI, gateWidth, -4*wallScaleByType[style]);
-	wallStyles[style]["entryFort"] = new WallElement("entryFort", "structures/" + civ + "_fortress", 0*PI, 8*wallScaleByType[style], 6*wallScaleByType[style]);
-	// Defensive wall elements with 0 width outside the wall
-	wallStyles[style]["outpost"] = new WallElement("outpost", "structures/" + civ + "_outpost", PI, 0, -4*wallScaleByType[style]);
-	wallStyles[style]["defenseTower"] = new WallElement("defenseTower", "structures/" + civ + "_defense_tower", PI, 0, -4*wallScaleByType[style]);
-	// Base buildings wall elements with 0 width inside the wall
-	wallStyles[style]["barracks"] = new WallElement("barracks", "structures/" + civ + "_barracks", PI, 0, 4.5*wallScaleByType[style]);
-	wallStyles[style]["civilCentre"] = new WallElement("civilCentre", "structures/" + civ + "_civil_centre", PI, 0, 4.5*wallScaleByType[style]);
-	wallStyles[style]["farmstead"] = new WallElement("farmstead", "structures/" + civ + "_farmstead", PI, 0, 4.5*wallScaleByType[style]);
-	wallStyles[style]["field"] = new WallElement("field", "structures/" + civ + "_field", PI, 0, 4.5*wallScaleByType[style]);
-	wallStyles[style]["fortress"] = new WallElement("fortress", "structures/" + civ + "_fortress", PI, 0, 4.5*wallScaleByType[style]);
-	wallStyles[style]["house"] = new WallElement("house", "structures/" + civ + "_house", PI, 0, 4.5*wallScaleByType[style]);
-	wallStyles[style]["market"] = new WallElement("market", "structures/" + civ + "_market", PI, 0, 4.5*wallScaleByType[style]);
-	wallStyles[style]["storehouse"] = new WallElement("storehouse", "structures/" + civ + "_storehouse", PI, 0, 4.5*wallScaleByType[style]);
-	wallStyles[style]["temple"] = new WallElement("temple", "structures/" + civ + "_temple", PI, 0, 4.5*wallScaleByType[style]);
-	// Generic space/gap wall elements
-	wallStyles[style]["space1"] = new WallElement("space1", undefined, 0*PI, wallScaleByType[style]);
-	wallStyles[style]["space2"] = new WallElement("space2", undefined, 0*PI, 2*wallScaleByType[style]);
-	wallStyles[style]["space3"] = new WallElement("space3", undefined, 0*PI, 3*wallScaleByType[style]);
-	wallStyles[style]["space4"] = new WallElement("space4", undefined, 0*PI, 4*wallScaleByType[style]);
+	this.type = type;
+	this.wall = wall || [];
+	this.centerToFirstElement = centerToFirstElement || undefined;
 }
-// Add wall fortresses for all generic styles
-wallStyles["athen"]["wallFort"] = new WallElement("wallFort", "structures/athen_fortress", 2*PI/2 /* PI/2 */, 5.1 /* 5.6 */, 1.9 /* 1.9 */);
-wallStyles["brit"]["wallFort"] = new WallElement("wallFort", "structures/brit_fortress", PI, 2.8);
-wallStyles["cart"]["wallFort"] = new WallElement("wallFort", "structures/cart_fortress", PI, 5.1, 1.6);
-wallStyles["gaul"]["wallFort"] = new WallElement("wallFort", "structures/gaul_fortress", PI, 4.2, 1.5);
-wallStyles["iber"]["wallFort"] = new WallElement("wallFort", "structures/iber_fortress", PI, 5, 0.2);
-wallStyles["mace"]["wallFort"] = new WallElement("wallFort", "structures/mace_fortress", 2*PI/2 /* PI/2 */, 5.1 /* 5.6 */, 1.9 /* 1.9 */);
-wallStyles["maur"]["wallFort"] = new WallElement("wallFort", "structures/maur_fortress", PI, 5.5);
-wallStyles["pers"]["wallFort"] = new WallElement("wallFort", "structures/pers_fortress", PI, 5.6/*5.5*/, 1.9/*1.7*/);
-wallStyles["ptol"]["wallFort"] = new WallElement("wallFort", "structures/ptol_fortress", 2*PI/2 /* PI/2 */, 5.1 /* 5.6 */, 1.9 /* 1.9 */);
-wallStyles["rome"]["wallFort"] = new WallElement("wallFort", "structures/rome_fortress", PI, 6.3, 2.1);
-wallStyles["sele"]["wallFort"] = new WallElement("wallFort", "structures/sele_fortress", 2*PI/2 /* PI/2 */, 5.1 /* 5.6 */, 1.9 /* 1.9 */);
-wallStyles["spart"]["wallFort"] = new WallElement("wallFort", "structures/spart_fortress", 2*PI/2 /* PI/2 */, 5.1 /* 5.6 */, 1.9 /* 1.9 */);
-// Adjust "rome_siege" style
-wallStyles["rome_siege"]["wallFort"] = new WallElement("wallFort", "structures/rome_army_camp", PI, 7.2, 2);
-wallStyles["rome_siege"]["entryFort"] = new WallElement("entryFort", "structures/rome_army_camp", PI, 12, 7);
-wallStyles["rome_siege"]["house"] = new WallElement("house", "structures/rome_tent", PI, 0, 4);
-
-// Add special wall styles not well to implement generic (and to show how custom styles can be added)
-
-// Add wall style "palisades"
-wallScaleByType["palisades"] = 0.55;
-wallStyles["palisades"] = {};
-wallStyles["palisades"]["wall"] = new WallElement("wall", "other/palisades_rocks_medium", 0*PI, 2.3);
-wallStyles["palisades"]["wallMedium"] = new WallElement("wall", "other/palisades_rocks_medium", 0*PI, 2.3);
-wallStyles["palisades"]["wallLong"] = new WallElement("wall", "other/palisades_rocks_long", 0*PI, 3.5);
-wallStyles["palisades"]["wallShort"] = new WallElement("wall", "other/palisades_rocks_short", 0*PI, 1.2);
-wallStyles["palisades"]["tower"] = new WallElement("tower", "other/palisades_rocks_tower", -PI/2, 0.7);
-wallStyles["palisades"]["wallFort"] = new WallElement("wallFort", "other/palisades_rocks_fort", PI, 1.7);
-wallStyles["palisades"]["gate"] = new WallElement("gate", "other/palisades_rocks_gate", PI, 3.6);
-wallStyles["palisades"]["entry"] = new WallElement("entry", undefined, wallStyles["palisades"]["gate"].angle, wallStyles["palisades"]["gate"].width);
-wallStyles["palisades"]["entryTower"] = new WallElement("entryTower", "other/palisades_rocks_watchtower", 0*PI, wallStyles["palisades"]["gate"].width, -3);
-wallStyles["palisades"]["entryFort"] = new WallElement("entryFort", "other/palisades_rocks_fort", PI, 6, 3);
-wallStyles["palisades"]["cornerIn"] = new WallElement("cornerIn", "other/palisades_rocks_curve", 3*PI/4, 2.1, 0.7, PI/2);
-wallStyles["palisades"]["cornerOut"] = new WallElement("cornerOut", "other/palisades_rocks_curve", 5*PI/4, 2.1, -0.7, -PI/2);
-wallStyles["palisades"]["outpost"] = new WallElement("outpost", "other/palisades_rocks_outpost", PI, 0, -2);
-wallStyles["palisades"]["house"] = new WallElement("house", "other/celt_hut", PI, 0, 5);
-wallStyles["palisades"]["barracks"] = new WallElement("barracks", "structures/gaul_tavern", PI, 0, 5);
-wallStyles["palisades"]["endRight"] = new WallElement("endRight", "other/palisades_rocks_end", -PI/2, 0.2);
-wallStyles["palisades"]["endLeft"] = new WallElement("endLeft", "other/palisades_rocks_end", PI/2, 0.2);
-
-// Add special wall style "road"
-// NOTE: This is not a wall style in the common sense. Use with care!
-wallStyles["road"] = {};
-wallStyles["road"]["short"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_short.xml", PI/2, 4.5);
-wallStyles["road"]["long"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_long.xml", PI/2, 9.5);
-wallStyles["road"]["cornerLeft"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_corner.xml", -PI/2, 4.5-2*1.25, 1.25, PI/2); // Correct width by -2*indent to fit xStraicht/corner
-wallStyles["road"]["cornerRight"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_corner.xml", 0*PI, 4.5-2*1.25, -1.25, -PI/2); // Correct width by -2*indent to fit xStraicht/corner
-wallStyles["road"]["curveLeft"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_curve_small.xml", -PI/2, 4.5+2*0.2, -0.2, PI/2); // Correct width by -2*indent to fit xStraicht/corner
-wallStyles["road"]["curveRight"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_curve_small.xml", 0*PI, 4.5+2*0.2, 0.2, -PI/2); // Correct width by -2*indent to fit xStraicht/corner
-wallStyles["road"]["start"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_end.xml", PI/2, 2);
-wallStyles["road"]["end"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_end.xml", -PI/2, 2);
-wallStyles["road"]["xStraight"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_intersect_x.xml", 0*PI, 4.5);
-wallStyles["road"]["xLeft"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_intersect_x.xml", 0*PI, 4.5, 0, PI/2);
-wallStyles["road"]["xRight"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_intersect_x.xml", 0*PI, 4.5, 0, -PI/2);
-wallStyles["road"]["tLeft"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_intersect_T.xml", PI, 4.5, 1.25);
-wallStyles["road"]["tRight"] = new WallElement("road", "actor|props/special/eyecandy/road_temperate_intersect_T.xml", 0*PI, 4.5, -1.25);
-
-// Add special wall element collection "other"
-// NOTE: This is not a wall style in the common sense. Use with care!
-wallStyles["other"] = {};
-wallStyles["other"]["fence"] = new WallElement("fence", "other/fence_long", -PI/2, 3.1);
-wallStyles["other"]["fence_medium"] = new WallElement("fence", "other/fence_long", -PI/2, 3.1);
-wallStyles["other"]["fence_short"] = new WallElement("fence_short", "other/fence_short", -PI/2, 1.5);
-wallStyles["other"]["fence_stone"] = new WallElement("fence_stone", "other/fence_stone", -PI/2, 2.5);
-wallStyles["other"]["palisade"] = new WallElement("palisade", "other/palisades_rocks_short", 0, 1.2);
-wallStyles["other"]["column"] = new WallElement("column", "other/column_doric", 0, 1);
-wallStyles["other"]["obelisk"] = new WallElement("obelisk", "other/obelisk", 0, 2);
-wallStyles["other"]["spike"] = new WallElement("spike", "other/palisades_angle_spike", -PI/2, 1);
-wallStyles["other"]["bench"] = new WallElement("bench", "other/bench", PI/2, 1.5);
-wallStyles["other"]["benchForTable"] = new WallElement("benchForTable", "other/bench", 0, 0.5);
-wallStyles["other"]["table"] = new WallElement("table", "other/table_rectangle", 0, 1);
-wallStyles["other"]["table_square"] = new WallElement("table_square", "other/table_square", PI/2, 1);
-wallStyles["other"]["flag"] = new WallElement("flag", "special/rallypoint", PI, 1);
-wallStyles["other"]["standing_stone"] = new WallElement("standing_stone", "gaia/special_ruins_standing_stone", PI, 1);
-wallStyles["other"]["settlement"] = new WallElement("settlement", "gaia/special_settlement", PI, 6);
-wallStyles["other"]["gap"] = new WallElement("gap", undefined, 0, 2);
-wallStyles["other"]["gapSmall"] = new WallElement("gapSmall", undefined, 0, 1);
-wallStyles["other"]["gapLarge"] = new WallElement("gapLarge", undefined, 0, 4);
-wallStyles["other"]["cornerIn"] = new WallElement("cornerIn", undefined, 0, 0, 0, PI/2);
-wallStyles["other"]["cornerOut"] = new WallElement("cornerOut", undefined, 0, 0, 0, -PI/2);
-
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//  fortressTypes data structure for some default fortress types
+//  g_FortressTypes data structure for some default fortress types (defined above)
 //
 //	A fortress type is just an instance of the Fortress class with actually something in it
 //	fortressTypes holds all the fortresses within an associative array with a descriptive string as key (e.g. matching the map size)
 //	Examples: "tiny", "veryLarge"
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-var fortressTypes = {};
-// Setup some default fortress types
-// Add fortress type "tiny"
-fortressTypes["tiny"] = new Fortress("tiny");
-var wallPart = ["gate", "tower", "wallShort", "cornerIn", "wallShort", "tower"];
-fortressTypes["tiny"].wall = wallPart.concat(wallPart, wallPart, wallPart);
-// Add fortress type "small"
-fortressTypes["small"] = new Fortress("small");
-var wallPart = ["gate", "tower", "wall", "cornerIn", "wall", "tower"];
-fortressTypes["small"].wall = wallPart.concat(wallPart, wallPart, wallPart);
-// Add fortress type "medium"
-fortressTypes["medium"] = new Fortress("medium");
-var wallPart = ["gate", "tower", "wallLong", "cornerIn", "wallLong", "tower"];
-fortressTypes["medium"].wall = wallPart.concat(wallPart, wallPart, wallPart);
-// Add fortress type "normal"
-fortressTypes["normal"] = new Fortress("normal");
-var wallPart = ["gate", "tower", "wall", "cornerIn", "wall", "cornerOut", "wall", "cornerIn", "wall", "tower"];
-fortressTypes["normal"].wall = wallPart.concat(wallPart, wallPart, wallPart);
-// Add fortress type "large"
-fortressTypes["large"] = new Fortress("large");
-var wallPart = ["gate", "tower", "wallLong", "cornerIn", "wallLong", "cornerOut", "wallLong", "cornerIn", "wallLong", "tower"];
-fortressTypes["large"].wall = wallPart.concat(wallPart, wallPart, wallPart);
-// Add fortress type "veryLarge"
-fortressTypes["veryLarge"] = new Fortress("veryLarge");
-var wallPart = ["gate", "tower", "wall", "cornerIn", "wall", "cornerOut", "wallLong", "cornerIn", "wallLong", "cornerOut", "wall", "cornerIn", "wall", "tower"];
-fortressTypes["veryLarge"].wall = wallPart.concat(wallPart, wallPart, wallPart);
-// Add fortress type "giant"
-fortressTypes["giant"] = new Fortress("giant");
-var wallPart = ["gate", "tower", "wallLong", "cornerIn", "wallLong", "cornerOut", "wallLong", "cornerIn", "wallLong", "cornerOut", "wallLong", "cornerIn", "wallLong", "tower"];
-fortressTypes["giant"].wall = wallPart.concat(wallPart, wallPart, wallPart);
+
+// Set some default fortress types
+for (let key of g_FortressTypeKeys)
+	g_FortressTypes[key] = new Fortress(key);
+
+g_FortressTypes["tiny"].wall = ["gate", "tower", "short", "cornerIn", "short", "tower"];
+g_FortressTypes["small"].wall = ["gate", "tower", "medium", "cornerIn", "medium", "tower"];
+g_FortressTypes["medium"].wall = ["gate", "tower", "long", "cornerIn", "long", "tower"];
+g_FortressTypes["normal"].wall = ["gate", "tower", "medium", "cornerIn", "medium", "cornerOut", "medium", "cornerIn", "medium", "tower"];
+g_FortressTypes["large"].wall = ["gate", "tower", "long", "cornerIn", "long", "cornerOut", "long", "cornerIn", "long", "tower"];
+g_FortressTypes["veryLarge"].wall = ["gate", "tower", "medium", "cornerIn", "medium", "cornerOut", "long", "cornerIn", "long", "cornerOut", "medium", "cornerIn", "medium", "tower"];
+g_FortressTypes["giant"].wall = ["gate", "tower", "long", "cornerIn", "long", "cornerOut", "long", "cornerIn", "long", "cornerOut", "long", "cornerIn", "long", "tower"];
+
+for (let type in g_FortressTypes)
+{
+	let wallPart = g_FortressTypes[type].wall;
+	g_FortressTypes[type].wall = wallPart.concat(wallPart, wallPart, wallPart);
+}
 
 // Setup some better looking semi default fortresses for "palisades" style
-var fortressTypeKeys = ["tiny", "small", "medium", "normal", "large", "veryLarge", "giant"];
-for (var i = 0; i < fortressTypeKeys.length; i++)
+for (let fortType of g_FortressTypeKeys)
 {
-	var newKey = fortressTypeKeys[i] + "Palisades";
-	var oldWall = fortressTypes[fortressTypeKeys[i]].wall;
-	fortressTypes[newKey] = new Fortress(newKey);
+	var newKey = fortType + "Palisades";
+	var oldWall = g_FortressTypes[fortType].wall;
+	g_FortressTypes[newKey] = new Fortress(newKey);
 	var fillTowersBetween = ["wallShort", "wall", "wallLong", "endLeft", "endRight", "cornerIn", "cornerOut"];
-	for (var j = 0; j < oldWall.length; j++)
+	for (var j = 0; j < oldWall.length; ++j)
 	{
-		fortressTypes[newKey].wall.push(oldWall[j]); // Only works if the first element is not in fillTowersBetween (e.g. entry or gate like it should be)
+		g_FortressTypes[newKey].wall.push(oldWall[j]); // Only works if the first element is not in fillTowersBetween (e.g. entry or gate like it should be)
 		if (j+1 < oldWall.length)
 			if (fillTowersBetween.indexOf(oldWall[j]) > -1 && fillTowersBetween.indexOf(oldWall[j+1]) > -1) // ... > -1 means "exists" here
-				fortressTypes[newKey].wall.push("tower");
+				g_FortressTypes[newKey].wall.push("tower");
 	}
 }
 
 // Setup some balanced (to civ type fortresses) semi default fortresses for "palisades" style
 // TODO
 
-// Add some "fortress types" for roads (will only work with style "road")
-// ["start", "short", "xRight", "xLeft", "cornerLeft", "xStraight", "long", "xLeft", "xRight", "cornerRight", "tRight", "tLeft", "xRight", "xLeft", "curveLeft", "xStraight", "curveRight", "end"];
-var wall = ["short", "curveLeft", "short", "curveLeft", "short", "curveLeft", "short", "curveLeft"];
-fortressTypes["road01"] = new Fortress("road01", wall);
-var wall = ["short", "cornerLeft", "short", "cornerLeft", "short", "cornerLeft", "short", "cornerLeft"];
-fortressTypes["road02"] = new Fortress("road02", wall);
-var wall = ["xStraight", "curveLeft", "xStraight", "curveLeft", "xStraight", "curveLeft", "xStraight", "curveLeft"];
-fortressTypes["road03"] = new Fortress("road03", wall);
-var wall = ["start", "curveLeft", "tRight", "cornerLeft", "tRight", "curveRight", "short", "xRight", "curveLeft", "xRight", "short", "cornerLeft", "tRight", "short",
-	"curveLeft", "short", "tRight", "cornerLeft", "short", "xRight", "curveLeft", "xRight", "short", "curveRight", "tRight", "cornerLeft", "tRight", "curveLeft", "end"];
-fortressTypes["road04"] = new Fortress("road04", wall);
-var wall = ["start", "tLeft", "short", "xRight",
-	"curveLeft", "xRight", "tRight", "cornerLeft", "tRight",
-	"curveLeft", "short", "tRight", "cornerLeft", "xRight",
-	"cornerLeft", "xRight", "short", "tRight", "curveLeft", "end"];
-fortressTypes["road05"] = new Fortress("road05", wall);
-
 
 ///////////////////////////////
 // Define some helper functions
 ///////////////////////////////
 
+/**
+ * Get a wall element of a style.
+ * 
+ * Valid elements:
+ *   long, medium, short, start, end, cornerIn, cornerOut, tower, fort, gate
+ * 
+ * Kept for backwards compatibility:
+ *   wallLong, wallMedium, wall, wallShort, endLeft, endRight, entry, entryTower, entryFort
+ * 
+ * If an element of the form `gap{x}` is requested, where `{x}` is a number,
+ * then a non-blocking gap of `x` length is returned.
+ * 
+ * If an element of the form `turn{x}` is requested where `{x}` is either
+ * `out` or `in` (case in-sensitive), then a 90 degree (PI/2 radians) bend
+ * with zero length is returned in the specified direction.
+ * 
+ * You can specify a normal structure (ie. `house`, `apadana` `barracks`)
+ * and the function will attempt to return the appropriate civ's building
+ * of that type with appropriate indentation away from the wall.
+ * @todo do something about the arbitrary-ness of the indent.
+ * 
+ * If after all that, the function still can't work out what's requested,
+ * it returns a wall tower.
+ * 
+ * @param style The style from which this element should come from
+ * @param element The element to fetch
+ * @return The wall element requested. Or a tower element.
+ */
+function getWallElement(style="athen_stone", element)
+{
+	if (g_WallStyleList.indexOf(style) < 0)
+	{
+		warn("getWallElement: Style '"+style+"' not recognised. (Falling back to '" + FALLBACK_CIV + "_stone'.)");
+		style = FALLBACK_CIV + "_stone";
+	}
+	if (g_WallStyles[style][element])
+		return g_WallStyles[style][element];
+
+	// Attempt to derive any unknown elements.
+	// Defaults to a wall tower piece
+	var wallset = g_WallStyles[style];
+	var civ = style.split("_")[0];
+	var ret = clone(wallset.tower);
+
+	// We use clone() so we don't change the attributes of the object we're referencing
+	switch (element)
+	{
+
+	case "cornerIn":
+		if (wallset.quarterCurve)
+			ret = clone(wallset.quarterCurve);
+		else
+		{
+			ret.angle += PI/4
+			ret.indent = ret.length * 0.25;
+			ret.length = 0;
+		}
+		ret.bend = PI/2;
+		break;
+
+	case "cornerOut":
+		if (wallset.quarterCurve)
+		{
+			ret = clone(wallset.quarterCurve);
+			ret.angle += PI/2;
+			ret.indent -= ret.indent*2;
+		}
+		else
+		{
+			ret.angle -= PI/4;
+			ret.length *= 0.71;
+		}
+		ret.bend = -PI/2;
+		break;
+
+	case "wallShort":
+		warn("getWallElement: Deprecated use of 'wallShort' (please use 'short')");
+		ret = clone(wallset.short);
+		break;
+
+	case "wallMedium":
+	case "wall":
+		warn("getWallElement: Deprecated use of '"+element+"' (please use 'medium')");
+		ret = clone(wallset.medium);
+		break;
+
+	case "wallLong":
+		warn("getWallElement: Deprecated use of 'wallLong' (please use 'long')");
+		ret = clone(wallset.long);
+		break;
+
+	case "entry":
+		ret.entPath = undefined;
+		ret.length = clone(g_WallStyles[style].gate.length);
+		break;
+
+	case "entryTower":
+		ret.entPath = (g_CivList.indexOf(civ) > -1) ? "structures/"+civ+"_defense_tower" : "other/palisades_rocks_watchtower";
+		ret.indent = ret.length * -3;
+		ret.length = clone(g_WallStyles[style].gate.length);
+		break;
+
+	case "entryFort":
+		ret = clone(g_WallStyles[style].fort);
+		ret.angle -= PI;
+		ret.length *= 1.5;
+		ret.indent = ret.length;
+		break;
+
+	case "endLeft":
+		warn("getWallElement: Deprecated use of 'endLeft' (please use 'start')");
+	case "start":
+		if (wallset.end)
+		{
+			ret = clone(wallset.end);
+			ret.angle += PI;
+		}
+		break;
+
+	case "endRight":
+		warn("getWallElement: Deprecated use of 'endRight' (please use 'end')");
+	case "end":
+		if (wallset.end)
+			ret = clone(wallset.end);
+		break;
+
+	default:
+		if (g_CivList.indexOf(civ) == -1)
+			civ = FALLBACK_CIV;
+		// Is it a structure?
+		var entPath = "structures/"+civ+"_"+element;
+		if (RMS.TemplateExists(entPath))
+		{
+			if (["outpost", "defense_tower"].indexOf(element) > -1)
+				ret.indent = ret.length * -3;
+			else
+				ret.indent = ret.length * 3.5;
+			ret.entPath = entPath;
+			ret.length = 0;
+		}
+		else if (element.slice(0, 3) === "gap") // A gap?
+		{
+			ret.entPath = undefined;
+			ret.angle = 0;
+			ret.length = +element.slice(3);
+		}
+		else if (element.slice(0, 4) === "turn") // A bend?
+		{
+			let dir = element.slice(4).toLowerCase();
+			if (dir === "out" || dir === "in")
+			{
+				ret.entPath = undefined;
+				ret.angle = PI/2;
+				ret.length = 0;
+				if (dir === "out")
+					ret.angle -= ret.angle;
+			}
+			else
+				warn("Unrecognised turn direction given: '"+dir+"' ("+ style+").");
+		}
+		else // Or... I give up.
+			warn("Unrecognised wall element: '"+element+"' ("+ style+"). Defaulting to 'tower'.");
+	}
+
+	// Cache to save having to calculate this element again
+	g_WallStyles[style][element] = ret;
+
+	return ret;
+}
+
+/**
+ * Set a wall element of a style.
+ * 
+ * @param style The style to which this element belongs
+ * @param element The element to add
+ * @param path The template path to read values from
+ */
+function setWallElement(style, element, path)
+{
+	var template = RMS.GetTemplate(path);
+	template = GetTemplateDataHelper(template);
+
+	if (!g_WallStyles[style])
+		g_WallStyles[style] = {};
+
+	var length = (template.wallPiece) ? template.wallPiece.length : template.obstruction.shape.width;
+	g_WallStyles[style][element] = {
+		"entPath": path,
+		"angle": (template.wallPiece) ? template.wallPiece.angle : PI,
+		"length": length / CELL_SIZE,
+		"indent": (template.wallPiece) ? template.wallPiece.indent / CELL_SIZE : 0,
+		"bend": (template.wallPiece) ? template.wallPiece.bend : 0
+	};
+}
+
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //  getWallAlignment
 //
@@ -320,50 +341,52 @@ fortressTypes["road05"] = new Fortress("road05", wall);
 //	Placing the first wall element at startX/startY placed with an angle given by orientation
 //	An alignment can be used to get the "center" of a "wall" (more likely used for fortresses) with getCenterToFirstElement
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function getWallAlignment(startX, startY, wall, style, orientation)
+function getWallAlignment(startX, startY, wall=[], style="athen_stone", orientation=0)
 {
-	// Graciously handle arguments
-	if (wall === undefined)
-		wall = [];
-	if (!wallStyles.hasOwnProperty(style))
-	{
-		warn("Function getWallAlignment: Unknown style: " + style + ' (falling back to "athen")');
-		style = "athen";
-	}
-	orientation = (orientation || 0);
-	
 	var alignment = [];
 	var wallX = startX;
 	var wallY = startY;
-	for (var i = 0; i < wall.length; i++)
+
+	for (var i = 0; i < wall.length; ++i)
 	{
-		var element = wallStyles[style][wall[i]];
+		var element = getWallElement(style, wall[i]);
 		if (element === undefined && i == 0)
-			warn("No valid wall element: " + wall[i]);
+		{
+			warn("Not a valid wall element: style = " + style + ", wall[" +i+ "] = " +wall[i]+ "; .entPath = " +element.entPath+ ", .length = " +element.length+ ", .angle = " +element.angle+ ", .indent = " +element.indent+ ", .bend = " +element.bend);
+			continue;
+		}
+
 		// Indentation
 		var placeX = wallX - element.indent * cos(orientation);
 		var placeY = wallY - element.indent * sin(orientation);
+
 		// Add wall elements entity placement arguments to the alignment
-		alignment.push({"x": placeX, "y": placeY, "entity": element.entity, "angle":orientation + element.angle});
+		alignment.push({"x": placeX, "y": placeY, "entPath": element.entPath, "angle":orientation + element.angle});
+
 		// Preset vars for the next wall element
 		if (i+1 < wall.length)
 		{
-			orientation += element.bending;
-			var nextElement = wallStyles[style][wall[i+1]];
+			orientation += element.bend;
+			var nextElement = getWallElement(style, wall[i+1]);
 			if (nextElement === undefined)
-				warn("No valid wall element: " + wall[i+1]);
-			var distance = (element.width + nextElement.width)/2;
+			{
+				warn("Not a valid wall element: style = " + style + ", wall[" +(i+1)+ "] = " +wall[i+1]+ "; .entPath = " +nextElement.entPath+ ", .length = " +nextElement.length+ ", .angle = " +nextElement.angle+ ", .indent = " +nextElement.indent+ ", .bend = " +nextElement.bend);
+				continue;
+			}
+			
+			var distance = (element.length + nextElement.length)/2 - getOverlap(style);
 			// Corrections for elements with indent AND bending
 			var indent = element.indent;
-			var bending = element.bending;
-			if (bending !== 0 && indent !== 0)
+			var bend = element.bend;
+			if (bend !== 0 && indent !== 0)
 			{
 				// Indent correction to adjust distance
-				distance += indent*sin(bending);
+				distance += indent*sin(bend);
 				// Indent correction to normalize indentation
 				wallX += indent * cos(orientation);
 				wallY += indent * sin(orientation);
 			}
+			
 			// Set the next coordinates of the next element in the wall without indentation adjustment
 			wallX -= distance * sin(orientation);
 			wallY += distance * cos(orientation);
@@ -383,7 +406,7 @@ function getWallAlignment(startX, startY, wall, style, orientation)
 function getCenterToFirstElement(alignment)
 {
 	var centerToFirstElement = {"x": 0, "y": 0};
-	for (var i = 0; i < alignment.length; i++)
+	for (var i = 0; i < alignment.length; ++i)
 	{
 		centerToFirstElement.x -= alignment[i].x/alignment.length;
 		centerToFirstElement.y -= alignment[i].y/alignment.length;
@@ -395,27 +418,31 @@ function getCenterToFirstElement(alignment)
 //  getWallLength
 //
 //	NOTE: Does not support bending wall elements like corners!
-//	e.g. used by placeIrregularPolygonalWall
 //////////////////////////////////////////////////////////////////
-function getWallLength(wall, style)
+function getWallLength(style, wall=[])
 {
 	// Graciously handle arguments
-	if (wall === undefined)
-		wall = [];
-	if (!wallStyles.hasOwnProperty(style))
+	if (g_WallStyleList.indexOf(style) < 0)
 	{
-		warn("Function getWallLength: Unknown style: " + style + ' (falling back to "athen")');
-		style = "athen";
+		warn("getWallLength: Unknown style: '" + style + "'. (Falling back to '" + FALLBACK_CIV + "_stone').");
+		style = FALLBACK_CIV +"_stone";
 	}
-	
+
 	var length = 0;
-	for (var i = 0; i < wall.length; i++)
-	{
-		length += wallStyles[style][wall[i]].width;
-	}
+	var overlap = getOverlap(style);
+	for (let element of wall)
+		length += getWallElement(style, element).length - overlap;
+
 	return length;
 }
 
+function getOverlap(style)
+{
+	if (!style || g_WallStyleList.indexOf(style) == -1)
+		style = (playerId == 0) ? "palisade" : getCivCode(playerId-1)+"_stone";
+	return g_WallStyles[style]["@overlap"];
+}
+
 
 /////////////////////////////////////////////
 // Define the different wall placer functions
@@ -427,7 +454,7 @@ function getWallLength(wall, style)
 //	Places a wall with wall elements attached to another like determined by WallElement properties.
 //
 //	startX, startY  Where the first wall element should be placed
-//	wall            Array of wall element type strings. Example: ["endLeft", "wallLong", "tower", "wallLong", "endRight"]
+//	wall            Array of wall element types. Example: ["start", "long", "tower", "long", "end"]
 //	style           Optional. Wall style string. Default is the civ of the given player, "palisades" for gaia
 //	playerId        Optional. Number of the player the wall will be placed for. Default is 0 (gaia)
 //	orientation     Optional. Angle the first wall element is placed. Default is 0
@@ -435,29 +462,20 @@ function getWallLength(wall, style)
 //	                It will then be build towards top/positive Y (if no bending wall elements like corners are used)
 //	                Raising orientation means the wall is rotated counter-clockwise like placeObject
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function placeWall(startX, startY, wall, style, playerId, orientation)
+function placeWall(startX=0, startY=0, wall=[], style, playerId=0, orientation=0)
 {
-	// Graciously handle arguments
-	if (wall === undefined)
-		wall = [];
-	playerId = (playerId || 0);
-	if (!wallStyles.hasOwnProperty(style))
-	{
-		if (playerId == 0)
-			style = (style || "palisades");
-		else
-			style = (getCivCode(playerId-1));
-	}
-	orientation = (orientation || 0);
+	if (!style || g_WallStyleList.indexOf(style) == -1)
+		style = (playerId == 0) ? "palisade" : getCivCode(playerId-1)+"_stone";
 	
 	// Get wall alignment
 	var AM = getWallAlignment(startX, startY, wall, style, orientation);
+	
 	// Place the wall
-	for (var iWall = 0; iWall < wall.length; iWall++)
+	for (var iWall = 0; iWall < wall.length; ++iWall)
 	{
-		var entity = AM[iWall].entity;
-		if (entity !== undefined)
-			placeObject(AM[iWall].x, AM[iWall].y, entity, playerId, AM[iWall].angle);
+		var entPath = AM[iWall].entPath;
+		if (entPath !== undefined)
+			placeObject(AM[iWall].x, AM[iWall].y, entPath, playerId, AM[iWall].angle);
 	}
 }
 
@@ -472,19 +490,12 @@ function placeWall(startX, startY, wall, style, playerId, orientation)
 //	playerId       Optional. Number of the player the wall will be placed for. Default is 0 (gaia)
 //	orientation    Optional. Angle the first wall element (should be a gate or entrance) is placed. Default is 0
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function placeCustomFortress(centerX, centerY, fortress, style, playerId, orientation)
+function placeCustomFortress(centerX, centerY, fortress, style, playerId=0, orientation=0)
 {
 	// Graciously handle arguments
-	fortress = (fortress || fortressTypes["medium"]);
-	playerId = (playerId || 0);
-	if (!wallStyles.hasOwnProperty(style))
-	{
-		if (playerId == 0)
-			style = (style || "palisades");
-		else
-			style = (getCivCode(playerId-1));
-	}
-	orientation = (orientation || 0);
+	fortress = fortress || g_FortressTypes["medium"];
+	if (!style || g_WallStyleList.indexOf(style) == -1)
+		style = (playerId == 0) ? "palisade" : getCivCode(playerId-1)+"_stone";
 	
 	// Calculate center if fortress.centerToFirstElement is undefined (default)
 	var centerToFirstElement = fortress.centerToFirstElement;
@@ -501,22 +512,14 @@ function placeCustomFortress(centerX, centerY, fortress, style, playerId, orient
 //
 //	Like placeCustomFortress just it takes type (a fortress type string, has to be in fortressTypes) instead of an instance of Fortress
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function placeFortress(centerX, centerY, type, style, playerId, orientation)
+function placeFortress(centerX, centerY, type="medium", style, playerId=0, orientation=0)
 {
 	// Graciously handle arguments
-	type = (type || "medium");
-	playerId = (playerId || 0);
-	if (!wallStyles.hasOwnProperty(style))
-	{
-		if (playerId == 0)
-			style = (style || "palisades");
-		else
-			style = (getCivCode(playerId-1));
-	}
-	orientation = (orientation || 0);
+	if (!style || g_WallStyleList.indexOf(style) == -1)
+		style = (playerId == 0) ? "palisade" : getCivCode(playerId-1)+"_stone";
 	
 	// Call placeCustomFortress with the given arguments
-	placeCustomFortress(centerX, centerY, fortressTypes[type], style, playerId, orientation);
+	placeCustomFortress(centerX, centerY, g_FortressTypes[type], style, playerId, orientation);
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -526,83 +529,79 @@ function placeFortress(centerX, centerY, type, style, playerId, orientation)
 //
 //	startX/startY    Coordinate of the approximate beginning of the wall (Not the place of the first wall element)
 //	targetX/targetY  Coordinate of the approximate ending of the wall (Not the place of the last wall element)
-//	wallPart         Optional. An array of NON-BENDING wall element type strings. Default is ["tower", "wallLong"]
+//	wallPart         Optional. An array of NON-BENDING wall element types. Default is ["tower", "wallLong"]
 //	style            Optional. Wall style string. Default is the civ of the given player, "palisades" for gaia
 //	playerId         Optional. Integer number of the player. Default is 0 (gaia)
 //	endWithFirst     Optional. A boolean value. If true the 1st wall element in the wallPart array will finalize the wall. Default is true
 //
 //	TODO: Maybe add angle offset for more generic looking?
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function placeLinearWall(startX, startY, targetX, targetY, wallPart, style, playerId, endWithFirst)
+function placeLinearWall(startX, startY, targetX, targetY, wallPart, style, playerId=0, endWithFirst=true)
 {
 	// Setup optional arguments to the default
-	wallPart = (wallPart || ["tower", "wallLong"]);
-	playerId = (playerId || 0);
-	if (!wallStyles.hasOwnProperty(style))
-	{
-		if (playerId == 0)
-			style = (style || "palisades");
-		else
-			style = (getCivCode(playerId-1));
-	}
-	endWithFirst = typeof endWithFirst == "undefined" ? true : endWithFirst;
+	wallPart = wallPart || ["tower", "long"];
+	if (!style || g_WallStyleList.indexOf(style) == -1)
+		style = (playerId == 0) ? "palisade" : getCivCode(playerId-1)+"_stone";
 	
 	// Check arguments
-	for (var elementIndex = 0; elementIndex < wallPart.length; elementIndex++)
-	{
-		var bending = wallStyles[style][wallPart[elementIndex]].bending;
-		if (bending != 0)
-			warn("Bending is not supported by placeLinearWall but a bending wall element is used: " + wallPart[elementIndex] + " -> wallStyles[style][wallPart[elementIndex]].entity");
-	}
+	for (let element of wallPart)
+		if (getWallElement(style, element).bend != 0)
+			warn("Bending is not supported by placeLinearWall but the following bending wall element was used: " + element);
+
 	// Setup number of wall parts
 	var totalLength = getDistance(startX, startY, targetX, targetY);
-	var wallPartLength = 0;
-	for (var elementIndex = 0; elementIndex < wallPart.length; elementIndex++)
-		wallPartLength += wallStyles[style][wallPart[elementIndex]].width;
+	var wallPartLength = getWallLength(style, wallPart);
 	var numParts = 0;
 	if (endWithFirst == true)
-		numParts = ceil((totalLength - wallStyles[style][wallPart[0]].width) / wallPartLength);
+		numParts = ceil((totalLength - getWallElement(style, wallPart[0]).length) / wallPartLength);
 	else
 		numParts = ceil(totalLength / wallPartLength);
+
 	// Setup scale factor
 	var scaleFactor = 1;
 	if (endWithFirst == true)
-		scaleFactor = totalLength / (numParts * wallPartLength + wallStyles[style][wallPart[0]].width);
+		scaleFactor = totalLength / (numParts * wallPartLength + getWallElement(style, wallPart[0]).length);
 	else
 		scaleFactor = totalLength / (numParts * wallPartLength);
+
 	// Setup angle
 	var wallAngle = getAngle(startX, startY, targetX, targetY); // NOTE: function "getAngle()" is about to be changed...
 	var placeAngle = wallAngle - PI/2;
 	// Place wall entities
 	var x = startX;
 	var y = startY;
-	for (var partIndex = 0; partIndex < numParts; partIndex++)
+	for (var partIndex = 0; partIndex < numParts; ++partIndex)
 	{
-		for (var elementIndex = 0; elementIndex < wallPart.length; elementIndex++)
+		for (var elementIndex = 0; elementIndex < wallPart.length; ++elementIndex)
 		{
-			var wallEle = wallStyles[style][wallPart[elementIndex]];
-			// Width correction
-			x += scaleFactor * wallEle.width/2 * cos(wallAngle);
-			y += scaleFactor * wallEle.width/2 * sin(wallAngle);
+			let wallEle = getWallElement(style, wallPart[elementIndex]);
+			let wallLength = (wallEle.length - getOverlap(style)) / 2;
+			let distX = scaleFactor * wallLength * cos(wallAngle);
+			let distY = scaleFactor * wallLength * sin(wallAngle);
+			// Length correction
+			x += distX;
+			y += distY;
 			// Indent correction
-			var placeX = x - wallEle.indent * sin(wallAngle);
-			var placeY = y + wallEle.indent * cos(wallAngle);
+			let placeX = x - wallEle.indent * sin(wallAngle);
+			let placeY = y + wallEle.indent * cos(wallAngle);
 			// Placement
-			var entity = wallEle.entity;
-			if (entity !== undefined)
-				placeObject(placeX, placeY, entity, playerId, placeAngle + wallEle.angle);
-			x += scaleFactor * wallEle.width/2 * cos(wallAngle);
-			y += scaleFactor * wallEle.width/2 * sin(wallAngle);
+			let entPath = wallEle.entPath;
+			if (entPath !== undefined)
+				placeObject(placeX, placeY, entPath, playerId, placeAngle + wallEle.angle);
+			// Prep for next object
+			x += distX;
+			y += distY;
 		}
 	}
 	if (endWithFirst == true)
 	{
-		var wallEle = wallStyles[style][wallPart[0]];
-		x += scaleFactor * wallEle.width/2 * cos(wallAngle);
-		y += scaleFactor * wallEle.width/2 * sin(wallAngle);
-		var entity = wallEle.entity;
-		if (entity !== undefined)
-			placeObject(x, y, entity, playerId, placeAngle + wallEle.angle);
+		var wallEle = getWallElement(style, wallPart[0]);
+		let wallLength = (wallEle.length - getOverlap(style)) / 2;
+		x += scaleFactor * wallLength * cos(wallAngle);
+		y += scaleFactor * wallLength * sin(wallAngle);
+		var entPath = wallEle.entPath;
+		if (entPath !== undefined)
+			placeObject(x, y, entPath, playerId, placeAngle + wallEle.angle);
 	}
 }
 
@@ -615,7 +614,7 @@ function placeLinearWall(startX, startY, targetX, targetY, wallPart, style, play
 //
 //	centerX/Y     Coordinates of the circle's center
 //	radius        How wide the circle should be (approximate, especially if maxBendOff != 0)
-//	wallPart      Optional. An array of NON-BENDING wall element type strings. Default is ["tower", "wallLong"]
+//	wallPart      Optional. An array of NON-BENDING wall element types. Default is ["tower", "wallLong"]
 //	style         Optional. Wall style string. Default is the civ of the given player, "palisades" for gaia
 //	playerId      Optional. Integer number of the player. Default is 0 (gaia)
 //	orientation   Optional. Where the open part of the (circular) arc should face (if maxAngle is < 2*PI). Default is 0
@@ -624,50 +623,38 @@ function placeLinearWall(startX, startY, targetX, targetY, wallPart, style, play
 //	maxBendOff    Optional. How irregular the circle should be. 0 means regular circle, PI/2 means very irregular. Default is 0 (regular circle)
 //
 //	NOTE: Don't use wall elements with bending like corners!
-//	TODO: Perhaps add eccentricity and maxBendOff functionality (untill now an unused argument)
+//	TODO: Perhaps add eccentricity
+//	TODO: Check if maxBendOff parameter works in all cases
 //	TODO: Perhaps add functionality for spirals
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function placeCircularWall(centerX, centerY, radius, wallPart, style, playerId, orientation, maxAngle, endWithFirst, maxBendOff)
+function placeCircularWall(centerX, centerY, radius, wallPart, style, playerId=0, orientation=0, maxAngle=TWO_PI, endWithFirst, maxBendOff=0)
 {
 	// Setup optional arguments to the default
-	wallPart = (wallPart || ["tower", "wallLong"]);
-	playerId = (playerId || 0);
-	if (!wallStyles.hasOwnProperty(style))
-	{
-		if (playerId == 0)
-			style = (style || "palisades");
-		else
-			style = (getCivCode(playerId-1));
-	}
-	orientation = (orientation || 0);
-	maxAngle = (maxAngle || 2*PI);
+	wallPart = wallPart || ["tower", "long"];
+	if (!style || g_WallStyleList.indexOf(style) == -1)
+		style = (playerId == 0) ? "palisade" : getCivCode(playerId-1)+"_stone";
 	if (endWithFirst === undefined)
 	{
-		if (maxAngle >= 2*PI - 0.001) // Can this be done better?
+		if (maxAngle >= TWO_PI - 0.001) // Can this be done better?
 			endWithFirst = false;
 		else
 			endWithFirst = true;
 	}
-	maxBendOff = (maxBendOff || 0);
 	
 	// Check arguments
 	if (maxBendOff > PI/2 || maxBendOff < 0)
-		warn("placeCircularWall maxBendOff sould satisfy 0 < maxBendOff < PI/2 (~1.5) but it is: " + maxBendOff);
-	for (var elementIndex = 0; elementIndex < wallPart.length; elementIndex++)
-	{
-		var bending = wallStyles[style][wallPart[elementIndex]].bending;
-		if (bending != 0)
-			warn("Bending is not supported by placeCircularWall but a bending wall element is used: " + wallPart[elementIndex]);
-	}
+		warn("placeCircularWall maxBendOff should satisfy 0 < maxBendOff < PI/2 (~1.5) but it is: " + maxBendOff);
+	for (let element of wallPart)
+		if (getWallElement(style, element).bend != 0)
+			warn("Bending is not supported by placeCircularWall but the following bending wall element was used: " + element);
+
 	// Setup number of wall parts
 	var totalLength = maxAngle * radius;
-	var wallPartLength = 0;
-	for (var elementIndex = 0; elementIndex < wallPart.length; elementIndex++)
-		wallPartLength += wallStyles[style][wallPart[elementIndex]].width;
+	var wallPartLength = getWallLength(style, wallPart);
 	var numParts = 0;
 	if (endWithFirst == true)
 	{
-		numParts = ceil((totalLength - wallStyles[style][wallPart[0]].width) / wallPartLength);
+		numParts = ceil((totalLength - getWallElement(style, wallPart[0]).length) / wallPartLength);
 	}
 	else
 	{
@@ -676,32 +663,32 @@ function placeCircularWall(centerX, centerY, radius, wallPart, style, playerId,
 	// Setup scale factor
 	var scaleFactor = 1;
 	if (endWithFirst == true)
-		scaleFactor = totalLength / (numParts * wallPartLength + wallStyles[style][wallPart[0]].width);
+		scaleFactor = totalLength / (numParts * wallPartLength + getWallElement(style, wallPart[0]).length);
 	else
 		scaleFactor = totalLength / (numParts * wallPartLength);
 	// Place wall entities
 	var actualAngle = orientation + (2*PI - maxAngle) / 2;
 	var x = centerX + radius*cos(actualAngle);
 	var y = centerY + radius*sin(actualAngle);
-	for (var partIndex = 0; partIndex < numParts; partIndex++)
+	for (let partIndex = 0; partIndex < numParts; ++partIndex)
 	{
-		for (var elementIndex = 0; elementIndex < wallPart.length; elementIndex++)
+		for (let wallEle of wallPart)
 		{
-			var wallEle = wallStyles[style][wallPart[elementIndex]];
+			wallEle = getWallElement(style, wallEle);
 			// Width correction
-			var addAngle = scaleFactor * wallEle.width / radius;
-			var targetX = centerX + radius * cos(actualAngle + addAngle);
-			var targetY = centerY + radius * sin(actualAngle + addAngle);
-			var placeX = x + (targetX - x)/2;
-			var placeY = y + (targetY - y)/2;
-			var placeAngle = actualAngle + addAngle/2;
+			let addAngle = scaleFactor * (wallEle.length - getOverlap(style)) / radius;
+			let targetX = centerX + radius * cos(actualAngle + addAngle);
+			let targetY = centerY + radius * sin(actualAngle + addAngle);
+			let placeX = x + (targetX - x)/2;
+			let placeY = y + (targetY - y)/2;
+			let placeAngle = actualAngle + addAngle/2;
 			// Indent correction
 			placeX -= wallEle.indent * cos(placeAngle);
 			placeY -= wallEle.indent * sin(placeAngle);
 			// Placement
-			var entity = wallEle.entity;
-			if (entity !== undefined)
-				placeObject(placeX, placeY, entity, playerId, placeAngle + wallEle.angle);
+			var entPath = wallEle.entPath;
+			if (entPath !== undefined)
+				placeObject(placeX, placeY, entPath, playerId, placeAngle + wallEle.angle);
 			// Prepare for the next wall element
 			actualAngle += addAngle;
 			x = centerX + radius*cos(actualAngle);
@@ -710,14 +697,14 @@ function placeCircularWall(centerX, centerY, radius, wallPart, style, playerId,
 	}
 	if (endWithFirst == true)
 	{
-		var wallEle = wallStyles[style][wallPart[0]];
-		var addAngle = scaleFactor * wallEle.width / radius;
+		var wallEle = getWallElement(style, wallPart[0]);
+		var addAngle = scaleFactor * wallEle.length / radius;
 		var targetX = centerX + radius * cos(actualAngle + addAngle);
 		var targetY = centerY + radius * sin(actualAngle + addAngle);
 		var placeX = x + (targetX - x)/2;
 		var placeY = y + (targetY - y)/2;
 		var placeAngle = actualAngle + addAngle/2;
-		placeObject(placeX, placeY, wallEle.entity, playerId, placeAngle + wallEle.angle);
+		placeObject(placeX, placeY, wallEle.entPath, playerId, placeAngle + wallEle.angle);
 	}
 }
 
@@ -728,7 +715,7 @@ function placeCircularWall(centerX, centerY, radius, wallPart, style, playerId,
 //
 //	centerX/Y          Coordinates of the polygon's center
 //	radius             How wide the circle should be in which the polygon fits
-//	wallPart           Optional. An array of NON-BENDING wall element type strings. Default is ["wallLong", "tower"]
+//	wallPart           Optional. An array of NON-BENDING wall element types. Default is ["wallLong", "tower"]
 //	cornerWallElement  Optional. Wall element to be placed at the polygon's corners. Default is "tower"
 //	style              Optional. Wall style string. Default is the civ of the given player, "palisades" for gaia
 //	playerId           Optional. Integer number of the player. Default is 0 (gaia)
@@ -741,43 +728,40 @@ function placeCircularWall(centerX, centerY, radius, wallPart, style, playerId,
 //	TODO: Check some arguments
 //	TODO: Add eccentricity and perhaps make it just call placeIrregularPolygonalWall with irregularity = 0
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function placePolygonalWall(centerX, centerY, radius, wallPart, cornerWallElement, style, playerId, orientation, numCorners, skipFirstWall)
+function placePolygonalWall(centerX, centerY, radius, wallPart, cornerWallElement, style, playerId=0, orientation=0, numCorners=8, skipFirstWall=true)
 {
 	// Setup optional arguments to the default
-	wallPart = (wallPart || ["wallLong", "tower"]);
-	cornerWallElement = (cornerWallElement || "tower"); // Don't use wide elements for this. Not supported well...
-	playerId = (playerId || 0);
-	if (!wallStyles.hasOwnProperty(style))
-	{
-		if (playerId == 0)
-			style = (style || "palisades");
-		else
-			style = (getCivCode(playerId-1));
-	}
-	orientation = (orientation || 0);
-	numCorners = (numCorners || 8);
-	skipFirstWall = (skipFirstWall || true);
-	
+	wallPart = wallPart || ["long", "tower"];
+	cornerWallElement = cornerWallElement || "tower"; // Don't use wide elements for this. Not supported well...
+	if (!style || g_WallStyleList.indexOf(style) == -1)
+		style = (playerId == 0) ? "palisade" : getCivCode(playerId-1)+"_stone";
+
 	// Setup angles
-	var angleAdd = 2*PI/numCorners;
+	var angleAdd = TWO_PI/numCorners;
 	var angleStart = orientation - angleAdd/2;
+
 	// Setup corners
 	var corners = [];
-	for (var i = 0; i < numCorners; i++)
+	for (let i = 0; i < numCorners; ++i)
 		corners.push([centerX + radius*cos(angleStart + i*angleAdd), centerY + radius*sin(angleStart + i*angleAdd)]);
+
 	// Place Corners and walls
-	for (var i = 0; i < numCorners; i++)
+	for (let i = 0; i < numCorners; ++i)
 	{
-		var angleToCorner = getAngle(corners[i][0], corners[i][1], centerX, centerY);
-		placeObject(corners[i][0], corners[i][1], wallStyles[style][cornerWallElement].entity, playerId, angleToCorner);
+		let angleToCorner = getAngle(corners[i][0], corners[i][1], centerX, centerY);
+		placeObject(corners[i][0], corners[i][1], getWallElement(style, cornerWallElement).entPath, playerId, angleToCorner);
 		if (!(skipFirstWall && i == 0))
 		{
+			let cornerLength = getWallElement(style, cornerWallElement).length / 2;
+			let cornerAngle = angleToCorner + angleAdd / 2;
+			let cornerX = cornerLength * sin(cornerAngle);
+			let cornerY = cornerLength * cos(cornerAngle);
 			placeLinearWall(
 				// Adjustment to the corner element width (approximately)
-				corners[i][0] + wallStyles[style][cornerWallElement].width/2 * sin(angleToCorner + angleAdd/2), // startX
-				corners[i][1] - wallStyles[style][cornerWallElement].width/2 * cos(angleToCorner + angleAdd/2), // startY
-				corners[(i+1)%numCorners][0] - wallStyles[style][cornerWallElement].width/2 * sin(angleToCorner + angleAdd/2), // targetX
-				corners[(i+1)%numCorners][1] + wallStyles[style][cornerWallElement].width/2 * cos(angleToCorner + angleAdd/2), // targetY
+				corners[i][0] + cornerX, // startX
+				corners[i][1] - cornerY, // startY
+				corners[(i+1)%numCorners][0] - cornerX, // targetX
+				corners[(i+1)%numCorners][1] + cornerY, // targetY
 				wallPart, style, playerId);
 		}
 	}
@@ -794,9 +778,9 @@ function placePolygonalWall(centerX, centerY, radius, wallPart, cornerWallElemen
 //	style                Optional. Wall style string. Default is the civ of the given player, "palisades" for gaia
 //	playerId             Optional. Integer number of the player. Default is 0 (gaia)
 //	orientation          Optional. Angle from the center to the first linear wall part placed. Default is 0 (towards positive X/right)
-//	numCorners           Optional. How many corners the polygon will have. Default is 8 (matching a civ centers territory)
+//	numCorners           Optional. How many corners the polygon will have. Default is randomly chosen from 'tween 5 & 7 inclusive
 //	irregularity         Optional. How irregular the polygon will be. 0 means regular, 1 means VERY irregular. Default is 0.5
-//	skipFirstWall        Optional. Boolean. If the first linear wall part will be left opened as entrance. Default is true
+//	skipFirstWall        Optional. Boolean. If the first linear wall part will be left opened as entrance. Default is false
 //	wallPartsAssortment  Optional. An array of wall part arrays to choose from for each linear wall connecting the corners. Default is hard to describe ^^
 //
 //	NOTE: wallPartsAssortment is put to the end because it's hardest to set
@@ -805,28 +789,23 @@ function placePolygonalWall(centerX, centerY, radius, wallPart, cornerWallElemen
 //	TODO: Check some arguments
 //	TODO: Perhaps add eccentricity
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function placeIrregularPolygonalWall(centerX, centerY, radius, cornerWallElement, style, playerId, orientation, numCorners, irregularity, skipFirstWall, wallPartsAssortment)
+function placeIrregularPolygonalWall(centerX, centerY, radius, cornerWallElement="tower", style, playerId=0, orientation=0, numCorners, irregularity=0.5, skipFirstWall=false, wallPartsAssortment)
 {
 	// Setup optional arguments
-	playerId = (playerId || 0);
-	if (!wallStyles.hasOwnProperty(style))
-	{
-		if (playerId == 0)
-			style = (style || "palisades");
-		else
-			style = (getCivCode(playerId-1));
-	}
-	
+	if (!style || g_WallStyleList.indexOf(style) == -1)
+		style = (playerId == 0) ? "palisade" : getCivCode(playerId-1)+"_stone";
+	numCorners = (numCorners || randInt(5, 7));
+
 	// Generating a generic wall part assortment with each wall part including 1 gate lengthened by walls and towers
 	// NOTE: It might be a good idea to write an own function for that...
-	var defaultWallPartsAssortment = [["wallShort"], ["wall"], ["wallLong"], ["gate", "tower", "wallShort"]];
+	var defaultWallPartsAssortment = [["short"], ["medium"], ["long"], ["gate", "tower", "short"]];
 	var centeredWallPart = ["gate"];
-	var extandingWallPartAssortment = [["tower", "wallLong"], ["tower", "wall"]];
+	var extandingWallPartAssortment = [["tower", "long"], ["tower", "medium"]];
 	defaultWallPartsAssortment.push(centeredWallPart);
-	for (var i = 0; i < extandingWallPartAssortment.length; i++)
+	for (var i = 0; i < extandingWallPartAssortment.length; ++i)
 	{
 		var wallPart = centeredWallPart;
-		for (var j = 0; j < radius; j++)
+		for (var j = 0; j < radius; ++j)
 		{
 			if (j%2 == 0)
 				wallPart = wallPart.concat(extandingWallPartAssortment[i]);
@@ -841,17 +820,11 @@ function placeIrregularPolygonalWall(centerX, centerY, radius, cornerWallElement
 	}
 	// Setup optional arguments to the default
 	wallPartsAssortment = (wallPartsAssortment || defaultWallPartsAssortment);
-	cornerWallElement = (cornerWallElement || "tower"); // Don't use wide elements for this. Not supported well...
-	style = (style || "palisades");
-	playerId = (playerId || 0);
-	orientation = (orientation || 0);
-	numCorners = (numCorners || randInt(5, 7));
-	irregularity = (irregularity || 0.5);
-	skipFirstWall = (skipFirstWall || false);
+
 	// Setup angles
-	var angleToCover = 2*PI;
+	var angleToCover = TWO_PI;
 	var angleAddList = [];
-	for (var i = 0; i < numCorners; i++)
+	for (var i = 0; i < numCorners; ++i)
 	{
 		// Randomize covered angles. Variety scales down with raising angle though...
 		angleAddList.push(angleToCover/(numCorners-i) * (1 + randFloat(-irregularity, irregularity)));
@@ -860,7 +833,7 @@ function placeIrregularPolygonalWall(centerX, centerY, radius, cornerWallElement
 	// Setup corners
 	var corners = [];
 	var angleActual = orientation - angleAddList[0]/2;
-	for (var i = 0; i < numCorners; i++)
+	for (var i = 0; i < numCorners; ++i)
 	{
 		corners.push([centerX + radius*cos(angleActual), centerY + radius*sin(angleActual)]);
 		if (i < numCorners - 1)
@@ -869,22 +842,23 @@ function placeIrregularPolygonalWall(centerX, centerY, radius, cornerWallElement
 	// Setup best wall parts for the different walls (a bit confusing naming...)
 	var wallPartLengths = [];
 	var maxWallPartLength = 0;
-	for (var partIndex = 0; partIndex < wallPartsAssortment.length; partIndex++)
+	for (let wallPart of wallPartsAssortment)
 	{
-		var length = wallPartLengths[partIndex];
-		wallPartLengths.push(getWallLength(wallPartsAssortment[partIndex], style));
+		var length = getWallLength(style, wallPart);
+		wallPartLengths.push(length);
 		if (length > maxWallPartLength)
 			maxWallPartLength = length;
 	}
+	
 	var wallPartList = []; // This is the list of the wall parts to use for the walls between the corners, not to confuse with wallPartsAssortment!
-	for (var i = 0; i < numCorners; i++)
+	for (var i = 0; i < numCorners; ++i)
 	{
-		var bestWallPart = []; // This is a simpel wall part not a wallPartsAssortment!
-		var bestWallLength = 99999999;
+		var bestWallPart = []; // This is a simple wall part not a wallPartsAssortment!
+		var bestWallLength = Number.MAX_VALUE;
 		// NOTE: This is not exactly like the length the wall will be in the end. Has to be tweaked...
 		var wallLength = getDistance(corners[i][0], corners[i][1], corners[(i+1)%numCorners][0], corners[(i+1)%numCorners][1]);
 		var numWallParts = ceil(wallLength/maxWallPartLength);
-		for (var partIndex = 0; partIndex < wallPartsAssortment.length; partIndex++)
+		for (var partIndex = 0; partIndex < wallPartsAssortment.length; ++partIndex)
 		{
 			var linearWallLength = numWallParts*wallPartLengths[partIndex];
 			if (linearWallLength < bestWallLength && linearWallLength > wallLength)
@@ -895,19 +869,21 @@ function placeIrregularPolygonalWall(centerX, centerY, radius, cornerWallElement
 		}
 		wallPartList.push(bestWallPart);
 	}
+
 	// Place Corners and walls
-	for (var i = 0; i < numCorners; i++)
+	for (var i = 0; i < numCorners; ++i)
 	{
 		var angleToCorner = getAngle(corners[i][0], corners[i][1], centerX, centerY);
-		placeObject(corners[i][0], corners[i][1], wallStyles[style][cornerWallElement].entity, playerId, angleToCorner);
+		placeObject(corners[i][0], corners[i][1], getWallElement(style, cornerWallElement).entPath, playerId, angleToCorner);
 		if (!(skipFirstWall && i == 0))
 		{
+			let cornerLength = getWallElement(style, cornerWallElement).length / 2;
 			placeLinearWall(
 				// Adjustment to the corner element width (approximately)
-				corners[i][0] + wallStyles[style][cornerWallElement].width/2 * sin(angleToCorner + angleAddList[i]/2), // startX
-				corners[i][1] - wallStyles[style][cornerWallElement].width/2 * cos(angleToCorner + angleAddList[i]/2), // startY
-				corners[(i+1)%numCorners][0] - wallStyles[style][cornerWallElement].width/2 * sin(angleToCorner + angleAddList[(i+1)%numCorners]/2), // targetX
-				corners[(i+1)%numCorners][1] + wallStyles[style][cornerWallElement].width/2 * cos(angleToCorner + angleAddList[(i+1)%numCorners]/2), // targetY
+				corners[i][0] + cornerLength * sin(angleToCorner + angleAddList[i]/2), // startX
+				corners[i][1] - cornerLength * cos(angleToCorner + angleAddList[i]/2), // startY
+				corners[(i+1)%numCorners][0] - cornerLength * sin(angleToCorner + angleAddList[(i+1)%numCorners]/2), // targetX
+				corners[(i+1)%numCorners][1] + cornerLength * cos(angleToCorner + angleAddList[(i+1)%numCorners]/2), // targetY
 				wallPartList[i], style, playerId, false);
 		}
 	}
@@ -920,41 +896,31 @@ function placeIrregularPolygonalWall(centerX, centerY, radius, cornerWallElement
 //	This is the default Iberian civ bonus starting wall
 //
 //	centerX/Y      The approximate center coordinates of the fortress
-//	radius         The approximate radius of the wall to be placed
+//	radius         Optional. The approximate radius of the wall to be placed. Default is 20
 //	playerId       Optional. Integer number of the player. Default is 0 (gaia)
 //	style          Optional. Wall style string. Default is the civ of the given player, "palisades" for gaia
-//	irregularity   Optional. Float between 0 (circle) and 1 (very spiky), default is 1/2
+//	irregularity   Optional. Float between 0 (circle) and 1 (very spiky), default is 0.5
 //	gateOccurence  Optional. Integer number, every n-th walls will be a gate instead. Default is 3
 //	maxTrys        Optional. How often the function tries to find a better fitting shape at max. Default is 100
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function placeGenericFortress(centerX, centerY, radius, playerId, style, irregularity, gateOccurence, maxTrys)
+function placeGenericFortress(centerX, centerY, radius=20, playerId=0, style, irregularity=0.5, gateOccurence=3, maxTrys=100)
 {
 	// Setup optional arguments
-	radius = (radius || 20);
-	playerId = (playerId || 0);
-	if (!wallStyles.hasOwnProperty(style))
-	{
-		if (playerId == 0)
-			style = (style || "palisades");
-		else
-			style = (getCivCode(playerId-1));
-	}
-	irregularity = (irregularity || 1/2);
-	gateOccurence = (gateOccurence || 3);
-	maxTrys = (maxTrys || 100);
+	if (!style || g_WallStyleList.indexOf(style) == -1)
+		style = (playerId == 0) ? "palisade" : getCivCode(playerId-1)+"_stone";
 	
 	// Setup some vars
 	var startAngle = randFloat(0, 2*PI);
 	var actualOffX = radius*cos(startAngle);
 	var actualOffY = radius*sin(startAngle);
 	var actualAngle = startAngle;
-	var pointDistance = wallStyles[style]["wallLong"].width + wallStyles[style]["tower"].width;
+	var pointDistance = getWallLength(style, ["long", "tower"]);
 	// Searching for a well fitting point derivation
 	var tries = 0;
 	var bestPointDerivation = undefined;
 	var minOverlap = 1000;
 	var overlap = undefined;
-	while (tries < maxTrys && minOverlap > wallStyles[style]["tower"].width / 10)
+	while (tries < maxTrys && minOverlap > getOverlap(style))
 	{
 		var pointDerivation = [];
 		var distanceToTarget = 1000;
@@ -963,8 +929,8 @@ function placeGenericFortress(centerX, centerY, radius, playerId, style, irregul
 		{
 			var indent = randFloat(-irregularity*pointDistance, irregularity*pointDistance);
 			var tmpAngle = getAngle(actualOffX, actualOffY,
-				(radius + indent)*cos(actualAngle + (pointDistance / radius)),
-				(radius + indent)*sin(actualAngle + (pointDistance / radius)));
+				(radius + indent)*cos(actualAngle + pointDistance / radius),
+				(radius + indent)*sin(actualAngle + pointDistance / radius));
 			actualOffX += pointDistance*cos(tmpAngle);
 			actualOffY += pointDistance*sin(tmpAngle);
 			actualAngle = getAngle(0, 0, actualOffX, actualOffY);
@@ -982,31 +948,34 @@ function placeGenericFortress(centerX, centerY, radius, playerId, style, irregul
 				}
 			}
 		}
-		tries++;
+		++tries;
 	}
 	log("placeGenericFortress: Reduced overlap to " + minOverlap + " after " + tries + " tries");
 	// Place wall
-	for (var pointIndex = 0; pointIndex < bestPointDerivation.length; pointIndex++)
+	for (var pointIndex = 0; pointIndex < bestPointDerivation.length; ++pointIndex)
 	{
 		var startX = centerX + bestPointDerivation[pointIndex][0];
 		var startY = centerY + bestPointDerivation[pointIndex][1];
 		var targetX = centerX + bestPointDerivation[(pointIndex + 1) % bestPointDerivation.length][0];
 		var targetY = centerY + bestPointDerivation[(pointIndex + 1) % bestPointDerivation.length][1];
 		var angle = getAngle(startX, startY, targetX, targetY);
-		var wallElement = "wallLong";
+		var wallElement = "long";
 		if ((pointIndex + 1) % gateOccurence == 0)
 			wallElement = "gate";
-		var entity = wallStyles[style][wallElement].entity;
-		if (entity)
+
+		var entPath = getWallElement(style, wallElement).entPath;
+		if (entPath)
 		{
 			placeObject(startX + (getDistance(startX, startY, targetX, targetY)/2)*cos(angle), // placeX
 				startY + (getDistance(startX, startY, targetX, targetY)/2)*sin(angle), // placeY
-				entity, playerId, angle - PI/2 + wallStyles[style][wallElement].angle);
+				entPath, playerId, angle - PI/2 + getWallElement(style, wallElement).angle);
 		}
 		// Place tower
 		var startX = centerX + bestPointDerivation[(pointIndex + bestPointDerivation.length - 1) % bestPointDerivation.length][0];
 		var startY = centerY + bestPointDerivation[(pointIndex + bestPointDerivation.length - 1) % bestPointDerivation.length][1];
 		var angle = getAngle(startX, startY, targetX, targetY);
-		placeObject(centerX + bestPointDerivation[pointIndex][0], centerY + bestPointDerivation[pointIndex][1], wallStyles[style]["tower"].entity, playerId, angle - PI/2 + wallStyles[style]["tower"].angle);
+
+		var tower = getWallElement(style, "tower");
+		placeObject(centerX + bestPointDerivation[pointIndex][0], centerY + bestPointDerivation[pointIndex][1], tower.entPath, playerId, angle - PI/2 + tower.angle);
 	}
 }
Index: binaries/data/mods/public/maps/random/schwarzwald.js
===================================================================
--- binaries/data/mods/public/maps/random/schwarzwald.js
+++ binaries/data/mods/public/maps/random/schwarzwald.js
@@ -131,7 +131,7 @@ var playerAngleMaxOff = playerAngleAddAvrg/4;
 // Setup paths
 var pathSucsessRadius = baseRadius/2;
 var pathAngleOff = PI/2;
-var pathWidth = 10; // This is not really the path's thickness in tiles but the number of tiles in the clumbs of the path
+var pathWidth = 10; // This is not really the path's thickness in tiles but the number of tiles in the clumps of the path
 
 // Setup additional resources
 var resourceRadius = 2*mapRadius/3; // 3*mapRadius/8;
@@ -159,8 +159,8 @@ HeightPlacer.prototype.place = function (constraint) {
 	constraint = (constraint || new NullConstraint());
 	
     var ret = [];
-    for (var x = 0; x < g_Map.size; x++) {
-        for (var y = 0; y < g_Map.size; y++) {
+    for (var x = 0; x < g_Map.size; ++x) {
+        for (var y = 0; y < g_Map.size; ++y) {
             if (g_Map.height[x][y] >= this.lowerBound && g_Map.height[x][y] <= this.upperBound && constraint.allows(x, y)) {
                 ret.push(new PointXZ(x, y));
             }
@@ -179,7 +179,7 @@ function getOrderOfPointsForShortestClosePath(points)
 	var distances = [];
 	if (points.length <= 3)
 	{
-		for (var i = 0; i < points.length; i++)
+		for (var i = 0; i < points.length; ++i)
 			order.push(i);
 		
 		return order;
@@ -187,7 +187,7 @@ function getOrderOfPointsForShortestClosePath(points)
 	
 	// Just add the first 3 points
 	var pointsToAdd = deepcopy(points);
-	for (var i = 0; i < min(points.length, 3); i++)
+	for (var i = 0; i < min(points.length, 3); i)
 	{
 		order.push(i);
 		pointsToAdd.shift(i);
@@ -198,13 +198,13 @@ function getOrderOfPointsForShortestClosePath(points)
 	
 	// Add remaining points so the path lengthens the least
 	var numPointsToAdd = pointsToAdd.length;
-	for (var i = 0; i < numPointsToAdd; i++)
+	for (var i = 0; i < numPointsToAdd; ++i)
 	{
 		var indexToAddTo = undefined;
 		var minEnlengthen = Infinity;
 		var minDist1 = 0;
 		var minDist2 = 0;
-		for (var k = 0; k < order.length; k++)
+		for (var k = 0; k < order.length; ++k)
 		{
 			var dist1 = getDistance(pointsToAdd[0][0], pointsToAdd[0][1], points[order[k]][0], points[order[k]][1]);
 			var dist2 = getDistance(pointsToAdd[0][0], pointsToAdd[0][1], points[order[(k + 1) % order.length]][0], points[order[(k + 1) % order.length]][1]);
@@ -232,19 +232,15 @@ function getOrderOfPointsForShortestClosePath(points)
 //
 ////////////////
 
-// Some heightmap constants
-const MIN_HEIGHT = - SEA_LEVEL; // -20
-const MAX_HEIGHT = 0xFFFF/HEIGHT_UNITS_PER_METRE - SEA_LEVEL; // A bit smaller than 90
-
 // Get the diferrence between minimum and maxumum height
 function getMinAndMaxHeight(reliefmap)
 {
 	var height = {};
 	height.min = Infinity;
 	height.max = - Infinity;
-	for (var x = 0; x < reliefmap.length; x++)
+	for (var x = 0; x < reliefmap.length; ++x)
 	{
-		for (var y = 0; y < reliefmap[x].length; y++)
+		for (var y = 0; y < reliefmap[x].length; ++y)
 		{
 			if (reliefmap[x][y] < height.min)
 				height.min = reliefmap[x][y];
@@ -264,8 +260,8 @@ function rescaleHeightmap(minHeight, maxHeight, heightmap)
 	var oldHeightRange = getMinAndMaxHeight(heightmap);
 	var max_x = heightmap.length;
 	var max_y = heightmap[0].length;
-	for (var x = 0; x < max_x; x++)
-		for (var y = 0; y < max_y; y++)
+	for (var x = 0; x < max_x; ++x)
+		for (var y = 0; y < max_y; ++y)
 			heightmap[x][y] = minHeight + (heightmap[x][y] - oldHeightRange.min) / (oldHeightRange.max - oldHeightRange.min) * (maxHeight - minHeight);
 }
 
@@ -288,21 +284,21 @@ function getStartLocationsByHeightmap(hightRange, maxTries, minDistToBorder, num
 	heightmap = (heightmap || g_Map.height);
 	
 	var validStartLocTiles = [];
-	for (var x = minDistToBorder; x < heightmap.length - minDistToBorder; x++)
-		for (var y = minDistToBorder; y < heightmap[0].length - minDistToBorder; y++)
+	for (var x = minDistToBorder; x < heightmap.length - minDistToBorder; ++x)
+		for (var y = minDistToBorder; y < heightmap[0].length - minDistToBorder; ++y)
 			if (heightmap[x][y] > hightRange.min && heightmap[x][y] < hightRange.max) // Has the right hight
 				validStartLocTiles.push([x, y]);
 	
 	var maxMinDist = 0;
-	for (var tries = 0; tries < maxTries; tries++)
+	for (var tries = 0; tries < maxTries; ++tries)
 	{
 		var startLoc = [];
 		var minDist = heightmap.length;
-		for (var p = 0; p < numberOfPlayers; p++)
+		for (var p = 0; p < numberOfPlayers; ++p)
 			startLoc.push(validStartLocTiles[randInt(validStartLocTiles.length)]);
-		for (var p1 = 0; p1 < numberOfPlayers - 1; p1++)
+		for (var p1 = 0; p1 < numberOfPlayers - 1; ++p1)
 		{
-			for (var p2 = p1 + 1; p2 < numberOfPlayers; p2++)
+			for (var p2 = p1 + 1; p2 < numberOfPlayers; ++p2)
 			{
 				var dist = getDistance(startLoc[p1][0], startLoc[p1][1], startLoc[p2][0], startLoc[p2][1]);
 				if (dist < minDist)
@@ -340,19 +336,19 @@ function derivateEntitiesByHeight(hightRange, startLoc, entityList, maxTries, mi
 	
 	var placements = deepcopy(startLoc);
 	var validTiles = [];
-	for (var x = minDistance; x < heightmap.length - minDistance; x++)
-		for (var y = minDistance; y < heightmap[0].length - minDistance; y++)
+	for (var x = minDistance; x < heightmap.length - minDistance; ++x)
+		for (var y = minDistance; y < heightmap[0].length - minDistance; ++y)
 			if (heightmap[x][y] > hightRange.min && heightmap[x][y] < hightRange.max) // Has the right hight
 				validTiles.push([x, y]);
 	
 	if (!validTiles.length)
 		return;
 	
-	for (var tries = 0; tries < maxTries; tries++)
+	for (var tries = 0; tries < maxTries; ++tries)
 	{
 		var tile = validTiles[randInt(validTiles.length)];
 		var isValid = true;
-		for (var p = 0; p < placements.length; p++)
+		for (var p = 0; p < placements.length; ++p)
 		{
 			if (getDistance(placements[p][0], placements[p][1], tile[0], tile[1]) < minDistance)
 			{
@@ -395,10 +391,10 @@ function setBaseTerrainDiamondSquare(minHeight, maxHeight, smoothness, initialHe
 		var newHeightmap = [];
 		var oldWidth = initialHeightmap.length;
 		// Square
-		for (var x = 0; x < 2 * oldWidth - 1; x++)
+		for (var x = 0; x < 2 * oldWidth - 1; ++x)
 		{
 			newHeightmap.push([]);
-			for (var y = 0; y < 2 * oldWidth - 1; y++)
+			for (var y = 0; y < 2 * oldWidth - 1; ++y)
 			{
 				if (x % 2 === 0 && y % 2 === 0) // Old tile
 					newHeightmap[x].push(initialHeightmap[x/2][y/2]);
@@ -412,9 +408,9 @@ function setBaseTerrainDiamondSquare(minHeight, maxHeight, smoothness, initialHe
 			}
 		}
 		// Diamond
-		for (var x = 0; x < 2 * oldWidth - 1; x++)
+		for (var x = 0; x < 2 * oldWidth - 1; ++x)
 		{
-			for (var y = 0; y < 2 * oldWidth - 1; y++)
+			for (var y = 0; y < 2 * oldWidth - 1; ++y)
 			{
 				if (newHeightmap[x][y] === undefined)
 				{
@@ -452,8 +448,8 @@ function setBaseTerrainDiamondSquare(minHeight, maxHeight, smoothness, initialHe
 	
 	// Cut initialHeightmap to fit target width
 	var shift = [floor((newHeightmap.length - heightmap.length) / 2), floor((newHeightmap[0].length - heightmap[0].length) / 2)];
-	for (var x = 0; x < heightmap.length; x++)
-		for (var y = 0; y < heightmap[0].length; y++)
+	for (var x = 0; x < heightmap.length; ++x)
+		for (var y = 0; y < heightmap[0].length; ++y)
 			heightmap[x][y] = newHeightmap[x][y];
 }
 
@@ -474,9 +470,9 @@ function decayErrodeHeightmap(strength, heightmap)
 	var map = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]; // smoother
 	var max_x = heightmap.length;
 	var max_y = heightmap[0].length;
-	for (var x = 0; x < max_x; x++)
-		for (var y = 0; y < max_y; y++)
-			for (var i = 0; i < map.length; i++)
+	for (var x = 0; x < max_x; ++x)
+		for (var y = 0; y < max_y; ++y)
+			for (var i = 0; i < map.length; ++i)
 				heightmap[x][y] += strength / map.length * (referenceHeightmap[(x + map[i][0] + max_x) % max_x][(y + map[i][1] + max_y) % max_y] - referenceHeightmap[x][y]); // Not entirely sure if scaling with map.length is perfect but tested values seam to indicate it is
 }
 
@@ -490,10 +486,10 @@ function rectangularSmoothToHeight(center, dx, dy, targetHeight, strength, heigh
 	heightmap = (heightmap || g_Map.height);
 	
 	var heightmapWin = [];
-	for (var wx = 0; wx < 2 * dx + 1; wx++)
+	for (var wx = 0; wx < 2 * dx + 1; ++wx)
 	{
 		heightmapWin.push([]);
-		for (var wy = 0; wy < 2 * dy + 1; wy++)
+		for (var wy = 0; wy < 2 * dy + 1; ++wy)
 		{
 			var actualX = x - dx + wx;
 			var actualY = y - dy + wy;
@@ -503,9 +499,9 @@ function rectangularSmoothToHeight(center, dx, dy, targetHeight, strength, heigh
 				heightmapWin[wx].push(targetHeight);
 		}
 	}
-	for (var wx = 0; wx < 2 * dx + 1; wx++)
+	for (var wx = 0; wx < 2 * dx + 1; ++wx)
 	{
-		for (var wy = 0; wy < 2 * dy + 1; wy++)
+		for (var wy = 0; wy < 2 * dy + 1; ++wy)
 		{
 			var actualX = x - dx + wx;
 			var actualY = y - dy + wy;
@@ -550,7 +546,7 @@ var initialReliefmap = [[heightRange.max, heightRange.max, heightRange.max], [he
 
 setBaseTerrainDiamondSquare(heightRange.min, heightRange.max, 0.5, initialReliefmap, g_Map.height);
 // Apply simple erosion
-for (var i = 0; i < 5; i++)
+for (var i = 0; i < 5; ++i)
 	decayErrodeHeightmap(0.5);
 rescaleHeightmap(heightRange.min, heightRange.max);
 
@@ -582,7 +578,7 @@ var heighLimits = [
 var startLocations = getStartLocationsByHeightmap({'min': heighLimits[4], 'max': heighLimits[5]});
 var playerHeight = (heighLimits[4] + heighLimits[5]) / 2;
 
-for (var i=0; i < numPlayers; i++)
+for (var i=0; i < numPlayers; ++i)
 {
 	playerAngle[i] = (playerAngleStart + i*playerAngleAddAvrg + randFloat(0, playerAngleMaxOff))%(2*PI);
 	var x = round(mapCenterX + randFloat(minPlayerRadius, maxPlayerRadius)*cos(playerAngle[i]));
@@ -604,7 +600,7 @@ for (var i=0; i < numPlayers; i++)
 	var distToSL = 15;
 	var resStartAngle = playerAngle[i] + PI;
 	var resAddAngle = 2*PI / startingResources.length;
-	for (var rIndex = 0; rIndex < startingResources.length; rIndex++)
+	for (var rIndex = 0; rIndex < startingResources.length; ++rIndex)
 	{
 		var angleOff = randFloat(-resAddAngle/2, resAddAngle/2);
 		var placeX = x + distToSL*cos(resStartAngle + rIndex*resAddAngle + angleOff);
@@ -644,13 +640,13 @@ if (doublePaths === true)
 	var maxI = numPlayers+1;
 else
 	var maxI = numPlayers;
-for (var i = 0; i < maxI; i++)
+for (var i = 0; i < maxI; ++i)
 {
 	if (doublePaths === true)
 		var minJ = 0;
 	else
 		var minJ = i+1;
-	for (var j = minJ; j < numPlayers+1; j++)
+	for (var j = minJ; j < numPlayers+1; ++j)
 	{
 		// Setup start and target coordinates
 		if (i < numPlayers)
@@ -700,7 +696,7 @@ for (var i = 0; i < maxI; i++)
 			}
 			if (getDistance(x, z, targetX, targetZ) < pathSucsessRadius)
 				targetReached = true;
-			tries++;
+			++tries;
 
 		}
 	}
@@ -761,14 +757,14 @@ RMS.SetProgress(90);
 
 // place trees
 log("Planting trees...");
-for (var x = 0; x < mapSize; x++)
+for (var x = 0; x < mapSize; ++x)
 {
-	for (var z = 0;z < mapSize;z++)
+	for (var z = 0; z < mapSize; ++z)
 	{
 		// Some variables
 		var radius = Math.pow(Math.pow(mapCenterX - x - 0.5, 2) + Math.pow(mapCenterZ - z - 0.5, 2), 1/2); // The 0.5 is a correction for the entities placed on the center of tiles
 		var minDistToSL = mapSize;
-		for (var i=0; i < numPlayers; i++)
+		for (var i=0; i < numPlayers; ++i)
 			minDistToSL = min(minDistToSL, getDistance(playerStartLocX[i], playerStartLocZ[i], x, z));
 		// Woods tile based
 		var tDensFactSL = max(min((minDistToSL - baseRadius) / baseRadius, 1), 0);
Index: binaries/data/mods/public/maps/random/wall_demo.js
===================================================================
--- binaries/data/mods/public/maps/random/wall_demo.js
+++ binaries/data/mods/public/maps/random/wall_demo.js
@@ -61,33 +61,31 @@ const distToOtherWalls = 10;
 var buildableMapSize = mapSize - 2 * distToMapBorder;
 var actualX = distToMapBorder;
 var actualY = distToMapBorder;
-// Wall styles are chosen by strings so the civ strings got by getCivCode() can be used
-// Other styles may be present as well but besides the civ styles only 'palisades' includes all wall element types (yet)
-const wallStyleList = ["athen", "brit", "cart", "gaul", "iber", "mace", "maur", "pers", "ptol", "rome", "sele", "spart", "rome_siege", "palisades"];
-
+var wallStyleList = g_WallStyleList;
 
 ////////////////////////////////////////
 // Custom wall placement (element based)
 ////////////////////////////////////////
-var wall = ['endLeft', 'wallLong', 'tower', 'wall', 'outpost', 'wall', 'cornerOut', 'wall', 'cornerIn', 'wall', 'house', 'endRight', 'entryTower', 'endLeft', 'wallShort', 'barracks', 'gate', 'tower', 'wall', 'wallFort', 'wall', 'endRight'];
-for (var styleIndex = 0; styleIndex < wallStyleList.length; styleIndex++)
+var wall = ['start', 'long', 'tower', 'tower', 'tower', 'medium', 'outpost', 'medium', 'cornerOut', 'medium', 'cornerIn', 'medium', 'house', 'end', 'entryTower', 'start', 'short', 'barracks', 'gate', 'tower', 'medium', 'fort', 'medium', 'end'];
+for (var styleIndex = 0; styleIndex < wallStyleList.length; ++styleIndex)
 {
 	var startX = actualX + styleIndex * buildableMapSize/wallStyleList.length; // X coordinate of the first wall element
 	var startY = actualY; // Y coordinate of the first wall element
-	var style = wallStyleList[styleIndex]; // // The wall's style like 'cart', 'iber', 'pers', 'rome', 'romeSiege' or 'palisades'
-	var orientation = styleIndex * PI/64; // Orientation of the first wall element. 0 means 'outside' or 'front' is right (positive X, like object placement)
+	var style = wallStyleList[styleIndex]; // The wall's style like 'cart', 'iber', 'pers', 'rome', 'romeSiege' or 'palisades'
+	var orientation = PI/16 * sin(styleIndex * PI/4); // Orientation of the first wall element. 0 means 'outside' or 'front' is right (positive X, like object placement in Atlas)
 	// That means the wall will be build towards top (positive Y) if no corners are used
 	var playerId = 0; // Owner of the wall (like in placeObject). 0 is Gaia, 1 is Player 1 (default color blue), ...
-	placeWall(startX, startY, wall, style, playerId, orientation); // Actually placing the wall
+	placeWall(startX, startY, wall, style, playerId, orientation); // Actually place the wall
 }
 actualX = distToMapBorder; // Reset actualX
 actualY += 80 + distToOtherWalls; // Increase actualY for next wall placement method
 
+
 //////////////////////////////////////////////////////////////
 // Default fortress placement (chosen by fortress type string)
 //////////////////////////////////////////////////////////////
 var fortressRadius = 15; // The space the fortresses take in average. Just for design of this map
-for (var styleIndex = 0; styleIndex < wallStyleList.length; styleIndex++)
+for (var styleIndex = 0; styleIndex < wallStyleList.length; ++styleIndex)
 {
 	var centerX = actualX + fortressRadius + styleIndex * buildableMapSize/wallStyleList.length; // X coordinate of the center of the fortress
 	var centerY = actualY + fortressRadius; // Y coordinate of the center of the fortress
@@ -99,7 +97,23 @@ for (var styleIndex = 0; styleIndex < wallStyleList.length; styleIndex++)
 	placeObject(centerX, centerY, 'other/obelisk', 0, 0*PI); // Place visual marker to see the center of the fortress
 }
 actualX = distToMapBorder; // Reset actualX
-actualY += 2 * fortressRadius + 2 * distToOtherWalls; // Increase actualY for next wall placement method
+actualY += 2 * fortressRadius + distToOtherWalls; // Increase actualY for next wall placement method
+
+//////////////////////////////////////////////////////////////
+// 'generic' fortress placement (iberian wall circuit code)
+//////////////////////////////////////////////////////////////
+var radius = min((mapSize - actualY - distToOtherWalls) / 3, (buildableMapSize / wallStyleList.length - distToOtherWalls) / 2); // The radius of wall circle
+for (var styleIndex = 0; styleIndex < wallStyleList.length; ++styleIndex)
+{
+	var centerX = actualX + radius + styleIndex * buildableMapSize/wallStyleList.length; // X coordinate of the center of the fortress
+	var centerY = actualY + radius; // Y coordinate of the center of the fortress
+	var style = wallStyleList[styleIndex]; // The wall's style like 'cart', 'iber', 'pers', 'rome', 'romeSiege' or 'palisades'
+	var playerId = 0; // Owner of the wall. 0 is Gaia, 1 is Player 1 (default color blue), ...
+	placeGenericFortress(centerX, centerY, radius, playerId, style); // Actually place the fortress
+	placeObject(centerX, centerY, 'other/obelisk', 0, 0*PI); // Place visual marker to see the center of the fortress
+}
+actualX = distToMapBorder; // Reset actualX
+actualY += 2 * radius + distToOtherWalls; // Increase actualY for next wall placement method
 
 //////////////////////////
 // Circular wall placement
@@ -108,11 +122,11 @@ actualY += 2 * fortressRadius + 2 * distToOtherWalls; // Increase actualY for ne
 var radius = min((mapSize - actualY - distToOtherWalls) / 3, (buildableMapSize / wallStyleList.length - distToOtherWalls) / 2); // The radius of wall circle
 var centerY = actualY + radius; // Y coordinate of the center of the wall circle
 var orientation = 0; // Where the wall circle will be open if maxAngle < 2*PI, see below. Otherwise where the first wall element will be placed
-for (var styleIndex = 0; styleIndex < wallStyleList.length; styleIndex++)
+for (var styleIndex = 0; styleIndex < wallStyleList.length; ++styleIndex)
 {
 	var centerX = actualX + radius + styleIndex * buildableMapSize/wallStyleList.length; // X coordinate of the center of the wall circle
 	var playerId = 0; // Player ID of the player owning the wall, 0 is Gaia, 1 is the first player (default blue), ...
-	var wallPart = ['tower', 'wall', 'house']; // List of wall elements the wall will be build of. Optional, default id ['wall']
+	var wallPart = ['tower', 'medium', 'house']; // List of wall elements the wall will be build of. Optional, default id ['wall']
 	var style = wallStyleList[styleIndex]; // The wall's style like 'cart', 'iber', 'pers', 'rome', 'romeSiege' or 'palisades'
 	var maxAngle = PI/2 * (styleIndex%3 + 2); // How far the wall should circumvent the center
 	placeCircularWall(centerX, centerY, radius, wallPart, style, playerId, orientation, maxAngle); // Actually placing the wall
@@ -122,19 +136,19 @@ for (var styleIndex = 0; styleIndex < wallStyleList.length; styleIndex++)
 actualX = distToMapBorder; // Reset actualX
 actualY += 2 * radius + distToOtherWalls; // Increase actualY for next wall placement method
 
-///////////////////////////
-// Polygonal wall placement
-///////////////////////////
+///////////////////////////////////
+// Regular Polygonal wall placement
+///////////////////////////////////
 // NOTE: Don't use bending wall elements like corners here!
 var radius = min((mapSize - actualY - distToOtherWalls) / 2, (buildableMapSize / wallStyleList.length - distToOtherWalls) / 2); // The radius of wall polygons
 var centerY = actualY + radius; // Y coordinate of the center of the wall polygon
 var orientation = 0; // Where the wall circle will be open if ???, see below. Otherwise where the first wall will be placed
-for (var styleIndex = 0; styleIndex < wallStyleList.length; styleIndex++)
+for (var styleIndex = 0; styleIndex < wallStyleList.length; ++styleIndex)
 {
 	var centerX = actualX + radius + styleIndex * buildableMapSize/wallStyleList.length; // X coordinate of the center of the wall circle
 	var playerId = 0; // Player ID of the player owning the wall, 0 is Gaia, 1 is the first player (default blue), ...
 	var cornerWallElement = 'tower'; // With wall element type will be uset for the corners of the polygon
-	var wallPart = ['wall', 'tower']; // List of wall elements the wall will be build of. Optional, default id ['wall']
+	var wallPart = ['medium', 'tower']; // List of wall elements the wall will be build of. Optional, default id ['wall']
 	var style = wallStyleList[styleIndex]; // The wall's style like 'cart', 'iber', 'pers', 'rome', 'romeSiege' or 'palisades'
 	var numCorners = (styleIndex)%6 + 3; // How many corners the plogon will have
 	var skipFirstWall = true; // If the wall should be open towards orientation
@@ -145,30 +159,51 @@ for (var styleIndex = 0; styleIndex < wallStyleList.length; styleIndex++)
 actualX = distToMapBorder; // Reset actualX
 actualY += 2 * radius + distToOtherWalls; // Increase actualY for next wall placement method
 
+/////////////////////////////////////
+// Irregular Polygonal wall placement
+/////////////////////////////////////
+// NOTE: Don't use bending wall elements like corners here!
+var radius = min((mapSize - actualY - distToOtherWalls) / 2, (buildableMapSize / wallStyleList.length - distToOtherWalls) / 2); // The radius of wall polygons
+var centerY = actualY + radius; // Y coordinate of the center of the wall polygon
+var orientation = 0; // Where the wall circle will be open if ???, see below. Otherwise where the first wall will be placed
+for (var styleIndex = 0; styleIndex < wallStyleList.length; ++styleIndex)
+{
+	var centerX = actualX + radius + styleIndex * buildableMapSize/wallStyleList.length; // X coordinate of the center of the wall circle
+	var playerId = 0; // Player ID of the player owning the wall, 0 is Gaia, 1 is the first player (default blue), ...
+	var cornerWallElement = 'tower'; // With wall element type will be uset for the corners of the polygon
+	var style = wallStyleList[styleIndex]; // The wall's style like 'cart', 'iber', 'pers', 'rome', 'romeSiege' or 'palisades'
+	var numCorners = (styleIndex)%6 + 3; // How many corners the plogon will have
+	var skipFirstWall = true; // If the wall should be open towards orientation
+	placeIrregularPolygonalWall(centerX, centerY, radius, cornerWallElement, style, playerId, orientation, numCorners, undefined, skipFirstWall);
+	placeObject(centerX, centerY, 'other/obelisk', 0, 0*PI); // Place visual marker to see the center of the wall circle
+	orientation += PI/16; // Increasing orientation to see how rotation works (like for object placement)
+}
+actualX = distToMapBorder; // Reset actualX
+actualY += 2 * radius + distToOtherWalls; // Increase actualY for next wall placement method
+
+
 ////////////////////////
 // Linear wall placement
 ////////////////////////
 // NOTE: Don't use bending wall elements like corners here!
 var maxWallLength = (mapSize - actualY - distToMapBorder - distToOtherWalls); // Just for this maps design. How long the longest wall will be
 var numWallsPerStyle = floor(buildableMapSize / distToOtherWalls / wallStyleList.length); // Just for this maps design. How many walls of the same style will be placed
-for (var styleIndex = 0; styleIndex < wallStyleList.length; styleIndex++)
+for (var styleIndex = 0; styleIndex < wallStyleList.length; ++styleIndex)
 {
-	for (var wallIndex = 0; wallIndex < numWallsPerStyle; wallIndex++)
+	for (var wallIndex = 0; wallIndex < numWallsPerStyle; ++wallIndex)
 	{
-		var startX = actualX + (styleIndex * numWallsPerStyle + wallIndex) * distToOtherWalls; // X coordinate the wall will start from
+		var startX = actualX + (styleIndex * numWallsPerStyle + wallIndex) * buildableMapSize/wallStyleList.length/numWallsPerStyle; // X coordinate the wall will start from
 		var startY = actualY; // Y coordinate the wall will start from
 		var endX = startX; // X coordinate the wall will end
 		var endY = actualY + (wallIndex + 1) * maxWallLength/numWallsPerStyle; // Y coordinate the wall will end
 		var playerId = 0; // Player ID of the player owning the wall, 0 is Gaia, 1 is the first player (default blue), ...
-		var wallPart = ['tower', 'wall']; // List of wall elements the wall will be build of
+		var wallPart = ['tower', 'medium']; // List of wall elements the wall will be build of
 		var style = wallStyleList[styleIndex]; // The wall's style like 'cart', 'iber', 'pers', 'rome', 'romeSiege' or 'palisades'
 		placeLinearWall(startX, startY, endX, endY, wallPart, style, playerId); // Actually placing the wall
 		// placeObject(startX, startY, 'other/obelisk', 0, 0*PI); // Place visual marker to see where exsactly the wall begins
 		// placeObject(endX, endY, 'other/obelisk', 0, 0*PI); // Place visual marker to see where exsactly the wall ends
 	}
 }
-actualX = distToMapBorder; // Reset actualX
-actualY += maxWallLength + distToOtherWalls; // Increase actualY for next wall placement method
 
 
 // Export map data
Index: binaries/data/mods/public/maps/random/wall_demo.json
===================================================================
--- binaries/data/mods/public/maps/random/wall_demo.json
+++ binaries/data/mods/public/maps/random/wall_demo.json
@@ -2,11 +2,12 @@
 	"settings" : {
 		"Name" : "Wall Demo",
 		"Script" : "wall_demo.js",
-		"Description" : "A demonstration of wall placement methods/code in random maps. Very large map size is recommended.",
+		"Description" : "A demonstration of wall placement methods/code in random maps. Giant map size is recommended!",
 		"BaseTerrain" : ["grass1"],
 		"BaseHeight" : 0,
 		"Keywords": ["demo"],
 		"CircularMap" : false,
+		"RevealMap": true,
 		"XXXXXX" : "Optionally define other things here, like we would for a scenario"
 	}
 }
\ No newline at end of file
Index: binaries/data/mods/public/simulation/components/WallPiece.js
===================================================================
--- binaries/data/mods/public/simulation/components/WallPiece.js
+++ binaries/data/mods/public/simulation/components/WallPiece.js
@@ -6,7 +6,22 @@ WallPiece.prototype.Schema =
 	"</a:example>" +
 	"<element name='Length'>" +
 		"<ref name='nonNegativeDecimal'/>" +
-    "</element>";
+    "</element>" +
+    "<optional>" +
+		"<element name='Orientation'>" +
+			"<ref name='nonNegativeDecimal'/>" +
+		"</element>" +
+	"</optional>" +
+	"<optional>" +
+		"<element name='Indent'>" +
+			"<data type='decimal'/>" +
+		"</element>" +
+	"</optional>" +
+	"<optional>" +
+		"<element name='Bend'>" +
+			"<data type='decimal'/>" +
+		"</element>" +
+	"</optional>";
 
 
 WallPiece.prototype.Init = function()
Index: binaries/data/mods/public/simulation/components/WallSet.js
===================================================================
--- binaries/data/mods/public/simulation/components/WallSet.js
+++ binaries/data/mods/public/simulation/components/WallSet.js
@@ -21,6 +21,26 @@ WallSet.prototype.Schema =
 			"<element name='WallShort' a:help='Template name of the short wall segment'>" +
 				"<text/>" +
 			"</element>" +
+			"<optional>" +
+				"<element name='WallCurveQuarter'>" +
+					"<text/>" +
+				"</element>" +
+			"</optional>" +
+			"<optional>" +
+				"<element name='WallCurveEighth'>" +
+					"<text/>" +
+				"</element>" +
+			"</optional>" +
+			"<optional>" +
+				"<element name='WallEnd'>" +
+					"<text/>" +
+				"</element>" +
+			"</optional>" +
+			"<optional>" +
+				"<element name='Fort'>" +
+					"<text/>" +
+				"</element>" +
+			"</optional>" +
 		"</interleave>" + 
 	"</element>" + 
 	"<element name='MinTowerOverlap' a:help='Maximum fraction that wall segments are allowed to overlap towers, where 0 signifies no overlap and 1 full overlap'>" + 
Index: binaries/data/mods/public/simulation/data/civs/athen.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/athen.json
+++ binaries/data/mods/public/simulation/data/civs/athen.json
@@ -109,6 +109,11 @@
 			"Special":"Train heroes and research technology pertaining to heroes."
 		}
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/athen_wallset_stone"
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/brit.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/brit.json
+++ binaries/data/mods/public/simulation/data/civs/brit.json
@@ -87,6 +87,11 @@
 			"Special": "" 
 		} 
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/brit_wallset_stone"
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/cart.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/cart.json
+++ binaries/data/mods/public/simulation/data/civs/cart.json
@@ -112,6 +112,11 @@
 			"Special":"Hire Iberian mercenaries."
 		}		
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/cart_wallset_stone"
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/gaul.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/gaul.json
+++ binaries/data/mods/public/simulation/data/civs/gaul.json
@@ -87,6 +87,11 @@
 			"Special": "" 
 		} 
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/gaul_wallset_stone"
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/iber.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/iber.json
+++ binaries/data/mods/public/simulation/data/civs/iber.json
@@ -85,6 +85,12 @@
 			"Special": "Defensive Aura - Gives all Iberian units and buildings within vision range of the monument a 10-15% attack boost. Build Limit: Only 5 may be built per map."
 		} 
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/iber_wallset_stone"
+		
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/mace.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/mace.json
+++ binaries/data/mods/public/simulation/data/civs/mace.json
@@ -114,6 +114,12 @@
 			"Special":"Constructs and upgrades all Macedonian siege engines."
 		}
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/mace_wallset_stone"
+		
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/maur.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/maur.json
+++ binaries/data/mods/public/simulation/data/civs/maur.json
@@ -94,6 +94,12 @@
 			"Special":"Contentment: +10% Health and +10% resource gathering rates for all citizens and allied citizens within its range. Can be built anywhere except in enemy territory. Max Built: 10."
 		}
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/maur_wallset_stone"
+		
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/pers.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/pers.json
+++ binaries/data/mods/public/simulation/data/civs/pers.json
@@ -104,6 +104,12 @@
 			"Special": "Train heroes and Persian Immortals. Gives a slow trickle of all resources as 'Satrapy Tribute.'" 
 		}
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/pers_wallset_stone"
+		
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/ptol.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/ptol.json
+++ binaries/data/mods/public/simulation/data/civs/ptol.json
@@ -113,6 +113,12 @@
 			"Special":"When built along the shoreline, removes shroud of darkness over all the water, revealing all the coast lines on the map. Limit: 1."
 		}
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/ptol_wallset_stone"
+		
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/rome.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/rome.json
+++ binaries/data/mods/public/simulation/data/civs/rome.json
@@ -89,6 +89,12 @@
 			"Special": "Can be built in neutral and enemy territory to strangle enemy towns." 
 		} 
 	],
+	"WallSets":
+	[
+		"structures/rome_wallset_stone",
+		"structures/rome_wallset_siege"
+		
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/sele.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/sele.json
+++ binaries/data/mods/public/simulation/data/civs/sele.json
@@ -114,6 +114,12 @@
 			"Special":"This is the Seleucid expansion building, similar to Civic Centers for other factions. It is weaker and carries a smaller territory influence, but is cheaper and built faster."
 		}
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/sele_wallset_stone"
+		
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/data/civs/spart.json
===================================================================
--- binaries/data/mods/public/simulation/data/civs/spart.json
+++ binaries/data/mods/public/simulation/data/civs/spart.json
@@ -105,6 +105,12 @@
 			"Special":"Train heroes and Spartiates and research technologies related to them."
 		}
 	],
+	"WallSets":
+	[
+		"other/wallset_palisade",
+		"structures/spart_wallset_stone"
+		
+	],
 	"StartEntities":
 	[
 		{
Index: binaries/data/mods/public/simulation/templates/other/palisades_rocks_curve.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/other/palisades_rocks_curve.xml
+++ binaries/data/mods/public/simulation/templates/other/palisades_rocks_curve.xml
@@ -25,4 +25,10 @@
   <VisualActor>
     <Actor>props/special/palisade_rocks_curve.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>8.0</Length>
+    <Orientation>0.75</Orientation>
+    <Indent>2.8</Indent>
+    <Bend>0.5</Bend>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/other/palisades_rocks_end.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/other/palisades_rocks_end.xml
+++ binaries/data/mods/public/simulation/templates/other/palisades_rocks_end.xml
@@ -25,4 +25,8 @@
   <VisualActor>
     <Actor>props/special/palisade_rocks_end.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>0.8</Length>
+    <Orientation>1.5</Orientation>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/other/palisades_rocks_fort.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/other/palisades_rocks_fort.xml
+++ binaries/data/mods/public/simulation/templates/other/palisades_rocks_fort.xml
@@ -8,4 +8,7 @@
     <Icon>structures/palisade_fort.png</Icon>
     <Classes datatype="tokens">Palisade</Classes>
   </Identity>
+  <WallPiece>
+    <Length>8.0</Length>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/other/palisades_rocks_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/other/palisades_rocks_long.xml
+++ binaries/data/mods/public/simulation/templates/other/palisades_rocks_long.xml
@@ -39,6 +39,6 @@
   </VisualActor>
   <TerritoryInfluence disable=""/>
   <WallPiece>
-    <Length>11.0</Length>
+    <Length>14.0</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/other/palisades_rocks_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/other/palisades_rocks_medium.xml
+++ binaries/data/mods/public/simulation/templates/other/palisades_rocks_medium.xml
@@ -38,6 +38,6 @@
   </VisualActor>
   <TerritoryInfluence disable=""/>
   <WallPiece>
-    <Length>8.0</Length>
+    <Length>9.2</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/other/palisades_rocks_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/other/palisades_rocks_short.xml
+++ binaries/data/mods/public/simulation/templates/other/palisades_rocks_short.xml
@@ -37,6 +37,6 @@
     <FoundationActor>structures/fndn_1x1pal.xml</FoundationActor>
   </VisualActor>
   <WallPiece>
-    <Length>4.0</Length>
+    <Length>4.8</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/other/wallset_palisade.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/other/wallset_palisade.xml
+++ binaries/data/mods/public/simulation/templates/other/wallset_palisade.xml
@@ -13,9 +13,12 @@
     <Templates>
       <Tower>other/palisades_rocks_tower</Tower>
       <Gate>other/palisades_rocks_gate</Gate>
+      <Fort>other/palisades_rocks_fort</Fort>
       <WallLong>other/palisades_rocks_long</WallLong>
       <WallMedium>other/palisades_rocks_medium</WallMedium>
       <WallShort>other/palisades_rocks_short</WallShort>
+      <WallCurveQuarter>other/palisades_rocks_curve</WallCurveQuarter>
+      <WallEnd>other/palisades_rocks_end</WallEnd>
     </Templates>
   </WallSet>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/athen_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/athen_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/athen_fortress.xml
@@ -25,4 +25,8 @@
   <VisualActor>
     <Actor>structures/athenians/fortress_up.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>24.0</Length>
+    <Indent>7.6</Indent>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/athen_wall_gate.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/athen_wall_gate.xml
+++ binaries/data/mods/public/simulation/templates/structures/athen_wall_gate.xml
@@ -20,6 +20,6 @@
     <Actor>structures/hellenes/wall_gate.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>38.0</Length>
+    <Length>35.4</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/athen_wall_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/athen_wall_long.xml
+++ binaries/data/mods/public/simulation/templates/structures/athen_wall_long.xml
@@ -17,6 +17,6 @@
     <Actor>structures/hellenes/wall_long.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>37.0</Length>
+    <Length>36.2</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/athen_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/athen_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/athen_wall_medium.xml
@@ -17,6 +17,6 @@
     <Actor>structures/hellenes/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>24.0</Length>
+    <Length>24.2</Length>
   </WallPiece>
-</Entity>
\ No newline at end of file
+</Entity>
Index: binaries/data/mods/public/simulation/templates/structures/athen_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/athen_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/athen_wall_short.xml
@@ -17,6 +17,6 @@
     <Actor>structures/hellenes/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>13.0</Length>
+    <Length>12.3</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/athen_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/athen_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/athen_wall_tower.xml
@@ -16,6 +16,6 @@
     <Actor>structures/hellenes/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>7.5</Length>
+    <Length>7.1</Length>
   </WallPiece>
-</Entity>
\ No newline at end of file
+</Entity>
Index: binaries/data/mods/public/simulation/templates/structures/brit_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/brit_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/brit_fortress.xml
@@ -54,4 +54,7 @@
     <Actor>structures/britons/fortress_briton.xml</Actor>
     <FoundationActor>structures/fndn_5x5.xml</FoundationActor>
   </VisualActor>
+  <WallPiece>
+    <Length>28</Length>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/brit_wall_gate.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/brit_wall_gate.xml
+++ binaries/data/mods/public/simulation/templates/structures/brit_wall_gate.xml
@@ -27,6 +27,6 @@
     <Actor>structures/celts/wall_gate.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>25.0</Length>
+    <Length>37.0</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/brit_wall_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/brit_wall_long.xml
+++ binaries/data/mods/public/simulation/templates/structures/brit_wall_long.xml
@@ -36,6 +36,6 @@
     <Actor>structures/celts/wall_long.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>37.0</Length>
+    <Length>36.6</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/brit_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/brit_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/brit_wall_medium.xml
@@ -33,6 +33,6 @@
     <Actor>structures/celts/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>25.0</Length>
+    <Length>24.6</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/brit_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/brit_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/brit_wall_short.xml
@@ -20,6 +20,6 @@
     <Actor>structures/celts/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>13.0</Length>
+    <Length>12.5</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/brit_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/brit_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/brit_wall_tower.xml
@@ -20,6 +20,6 @@
     <Actor>structures/celts/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>9.0</Length>
+    <Length>8.7</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/cart_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/cart_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/cart_fortress.xml
@@ -31,4 +31,8 @@
   <VisualActor>
     <Actor>structures/carthaginians/fortress.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>25.0</Length>
+    <Indent>6.4</Indent>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/cart_wall_gate.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/cart_wall_gate.xml
+++ binaries/data/mods/public/simulation/templates/structures/cart_wall_gate.xml
@@ -20,6 +20,6 @@
     <Actor>structures/carthaginians/wall_gate.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>25.0</Length>
+    <Length>43.8</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/cart_wall_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/cart_wall_long.xml
+++ binaries/data/mods/public/simulation/templates/structures/cart_wall_long.xml
@@ -36,6 +36,6 @@
     <Actor>structures/carthaginians/wall_long.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>46.0</Length>
+    <Length>43.7</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/cart_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/cart_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/cart_wall_medium.xml
@@ -30,6 +30,6 @@
     <Actor>structures/carthaginians/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>30.0</Length>
+    <Length>29.3</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/cart_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/cart_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/cart_wall_short.xml
@@ -17,6 +17,6 @@
     <Actor>structures/carthaginians/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>16.0</Length>
+    <Length>14.7</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/cart_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/cart_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/cart_wall_tower.xml
@@ -20,6 +20,6 @@
     <FoundationActor>structures/fndn_3x3.xml</FoundationActor>
   </VisualActor>
   <WallPiece>
-    <Length>11.0</Length>
+    <Length>11.8</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/gaul_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/gaul_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/gaul_fortress.xml
@@ -34,4 +34,8 @@
   <VisualActor>
     <Actor>structures/gauls/fortress_gallic.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>16.8</Length>
+    <Indent>5.8</Indent>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/gaul_wall_gate.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/gaul_wall_gate.xml
+++ binaries/data/mods/public/simulation/templates/structures/gaul_wall_gate.xml
@@ -27,6 +27,6 @@
     <Actor>structures/celts/wall_gate.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>25.0</Length>
+    <Length>37.0</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/gaul_wall_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/gaul_wall_long.xml
+++ binaries/data/mods/public/simulation/templates/structures/gaul_wall_long.xml
@@ -36,6 +36,6 @@
     <Actor>structures/celts/wall_long.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>37.0</Length>
+    <Length>36.6</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/gaul_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/gaul_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/gaul_wall_medium.xml
@@ -33,6 +33,6 @@
     <Actor>structures/celts/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>25.0</Length>
+    <Length>24.6</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/gaul_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/gaul_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/gaul_wall_short.xml
@@ -20,6 +20,6 @@
     <Actor>structures/celts/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>13.0</Length>
+    <Length>12.6</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/gaul_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/gaul_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/gaul_wall_tower.xml
@@ -20,6 +20,6 @@
     <Actor>structures/celts/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>9.0</Length>
+    <Length>8.7</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/iber_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/iber_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/iber_fortress.xml
@@ -37,4 +37,7 @@
   <VisualActor>
     <Actor>structures/iberians/fortress.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>24.5</Length>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/iber_wall_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/iber_wall_long.xml
+++ binaries/data/mods/public/simulation/templates/structures/iber_wall_long.xml
@@ -36,6 +36,6 @@
     <Actor>structures/iberians/wall_long.xml</Actor>
   </VisualActor>
   <WallPiece>
-  	<Length>36.0</Length>
+  	<Length>36.4</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/iber_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/iber_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/iber_wall_medium.xml
@@ -33,6 +33,6 @@
     <Actor>structures/iberians/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-  	<Length>24.0</Length>
+  	<Length>24.4</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/iber_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/iber_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/iber_wall_short.xml
@@ -20,6 +20,6 @@
     <Actor>structures/iberians/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-  	<Length>12.0</Length>
+  	<Length>12.4</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/iber_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/iber_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/iber_wall_tower.xml
@@ -21,6 +21,6 @@
     <Actor>structures/iberians/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>10</Length>
+    <Length>10.8</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/mace_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/mace_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/mace_fortress.xml
@@ -40,4 +40,8 @@
   <VisualActor>
     <Actor>structures/macedonians/fortress_up.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>24.0</Length>
+    <Indent>7.6</Indent>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/mace_wall_gate.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/mace_wall_gate.xml
+++ binaries/data/mods/public/simulation/templates/structures/mace_wall_gate.xml
@@ -20,6 +20,6 @@
     <Actor>structures/hellenes/wall_gate.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>38.0</Length>
+    <Length>35.4</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/mace_wall_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/mace_wall_long.xml
+++ binaries/data/mods/public/simulation/templates/structures/mace_wall_long.xml
@@ -17,6 +17,6 @@
     <Actor>structures/hellenes/wall_long.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>37.0</Length>
+    <Length>36.2</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/mace_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/mace_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/mace_wall_medium.xml
@@ -17,6 +17,6 @@
     <Actor>structures/hellenes/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>24.0</Length>
+    <Length>24.2</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/mace_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/mace_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/mace_wall_short.xml
@@ -17,6 +17,6 @@
     <Actor>structures/hellenes/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>13.0</Length>
+    <Length>12.3</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/mace_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/mace_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/mace_wall_tower.xml
@@ -16,6 +16,6 @@
     <Actor>structures/hellenes/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>7.5</Length>
+    <Length>7.1</Length>
   </WallPiece>
-</Entity>
\ No newline at end of file
+</Entity>
Index: binaries/data/mods/public/simulation/templates/structures/maur_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/maur_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/maur_fortress.xml
@@ -28,4 +28,7 @@
   <VisualActor>
     <Actor>structures/mauryans/fortress.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>22.0</Length>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/maur_wall_gate.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/maur_wall_gate.xml
+++ binaries/data/mods/public/simulation/templates/structures/maur_wall_gate.xml
@@ -20,6 +20,6 @@
     <Actor>structures/mauryans/wall_gate.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>37.0</Length>
+    <Length>36.7</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/maur_wall_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/maur_wall_long.xml
+++ binaries/data/mods/public/simulation/templates/structures/maur_wall_long.xml
@@ -42,6 +42,6 @@
     <Actor>structures/mauryans/wall_long.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>35.0</Length>
+    <Length>36.6</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/maur_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/maur_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/maur_wall_medium.xml
@@ -36,6 +36,6 @@
     <Actor>structures/mauryans/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>24.0</Length>
+    <Length>24.4</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/maur_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/maur_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/maur_wall_short.xml
@@ -23,6 +23,6 @@
     <Actor>structures/mauryans/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>13.0</Length>
+    <Length>12.4</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/maur_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/maur_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/maur_wall_tower.xml
@@ -25,6 +25,6 @@
     <Actor>structures/mauryans/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>9.5</Length>
+    <Length>7.8</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/pers_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/pers_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/pers_fortress.xml
@@ -20,4 +20,8 @@
   <VisualActor>
     <Actor>structures/persians/fortress.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>24.5</Length>
+    <Indent>7.6</Indent>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/pers_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/pers_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/pers_wall_tower.xml
@@ -16,6 +16,6 @@
     <Actor>structures/persians/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-  	<Length>8.5</Length>
+  	<Length>7.5</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/ptol_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/ptol_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/ptol_fortress.xml
@@ -31,4 +31,8 @@
   <VisualActor>
     <Actor>structures/ptolemies/fortress.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>24.0</Length>
+    <Indent>8.7</Indent>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/ptol_wall_gate.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/ptol_wall_gate.xml
+++ binaries/data/mods/public/simulation/templates/structures/ptol_wall_gate.xml
@@ -20,6 +20,6 @@
     <Actor>structures/ptolemies/wall_gate.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>38.0</Length>
+    <Length>38.8</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/ptol_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/ptol_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/ptol_wall_medium.xml
@@ -30,6 +30,6 @@
     <Actor>structures/ptolemies/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>26.0</Length>
+    <Length>25.0</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/ptol_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/ptol_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/ptol_wall_short.xml
@@ -17,6 +17,6 @@
     <Actor>structures/ptolemies/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>14.0</Length>
+    <Length>16.0</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/ptol_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/ptol_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/ptol_wall_tower.xml
@@ -16,6 +16,6 @@
     <Actor>structures/ptolemies/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>10</Length>
+    <Length>9.0</Length>
   </WallPiece>
-</Entity>
\ No newline at end of file
+</Entity>
Index: binaries/data/mods/public/simulation/templates/structures/ptol_wallset_stone.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/ptol_wallset_stone.xml
+++ binaries/data/mods/public/simulation/templates/structures/ptol_wallset_stone.xml
@@ -14,6 +14,6 @@
       <WallShort>structures/ptol_wall_short</WallShort>
     </Templates>
     <MaxTowerOverlap>0.90</MaxTowerOverlap>
-    <MinTowerOverlap>0.05</MinTowerOverlap>
+    <MinTowerOverlap>0.10</MinTowerOverlap>
   </WallSet>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml
+++ binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml
@@ -101,4 +101,8 @@
     <Actor>structures/romans/camp.xml</Actor>
     <FoundationActor>structures/fndn_8x8.xml</FoundationActor>
   </VisualActor>
+  <WallPiece>
+    <Length>29.5</Length>
+    <Indent>8</Indent>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/rome_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/rome_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/rome_fortress.xml
@@ -23,4 +23,8 @@
   <VisualActor>
     <Actor>structures/romans/fortress.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>25.0</Length>
+    <Indent>8.4</Indent>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/rome_siege_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/rome_siege_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/rome_siege_wall_tower.xml
@@ -43,6 +43,6 @@
     <Actor>structures/romans/siege_wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>6.0</Length>
+    <Length>5.5</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/rome_wall_gate.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/rome_wall_gate.xml
+++ binaries/data/mods/public/simulation/templates/structures/rome_wall_gate.xml
@@ -20,6 +20,6 @@
     <Actor>structures/romans/wall_gate.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>37.0</Length>
+    <Length>36.8</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/rome_wall_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/rome_wall_long.xml
+++ binaries/data/mods/public/simulation/templates/structures/rome_wall_long.xml
@@ -36,6 +36,6 @@
     <Actor>structures/romans/wall_long.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>37.0</Length>
+    <Length>36.8</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/rome_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/rome_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/rome_wall_medium.xml
@@ -33,6 +33,6 @@
     <Actor>structures/romans/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>25.0</Length>
+    <Length>24.8</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/rome_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/rome_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/rome_wall_short.xml
@@ -20,6 +20,6 @@
     <Actor>structures/romans/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>13.0</Length>
+    <Length>12.9</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/rome_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/rome_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/rome_wall_tower.xml
@@ -16,6 +16,6 @@
     <Actor>structures/romans/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>9.5</Length>
+    <Length>10</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/rome_wallset_siege.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/rome_wallset_siege.xml
+++ binaries/data/mods/public/simulation/templates/structures/rome_wallset_siege.xml
@@ -13,6 +13,7 @@
     <Templates>
       <Tower>structures/rome_siege_wall_tower</Tower>
       <Gate>structures/rome_siege_wall_gate</Gate>
+      <Fort>structures/rome_army_camp</Fort>
       <WallLong>structures/rome_siege_wall_long</WallLong>
       <WallMedium>structures/rome_siege_wall_medium</WallMedium>
       <WallShort>structures/rome_siege_wall_short</WallShort>
Index: binaries/data/mods/public/simulation/templates/structures/sele_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/sele_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/sele_fortress.xml
@@ -34,4 +34,8 @@
   <VisualActor>
     <Actor>structures/seleucids/fortress.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>23</Length>
+    <Indent>7.8</Indent>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/sele_wall_gate.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/sele_wall_gate.xml
+++ binaries/data/mods/public/simulation/templates/structures/sele_wall_gate.xml
@@ -20,6 +20,6 @@
     <Actor>structures/hellenes/wall_gate.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>38.0</Length>
+    <Length>35.4</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/sele_wall_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/sele_wall_long.xml
+++ binaries/data/mods/public/simulation/templates/structures/sele_wall_long.xml
@@ -17,6 +17,6 @@
     <Actor>structures/hellenes/wall_long.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>37.0</Length>
+    <Length>36.2</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/sele_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/sele_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/sele_wall_medium.xml
@@ -17,6 +17,6 @@
     <Actor>structures/hellenes/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>24.0</Length>
+    <Length>24.2</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/sele_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/sele_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/sele_wall_short.xml
@@ -17,6 +17,6 @@
     <Actor>structures/hellenes/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>13.0</Length>
+    <Length>12.3</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/sele_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/sele_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/sele_wall_tower.xml
@@ -16,6 +16,6 @@
     <Actor>structures/hellenes/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>7.5</Length>
+    <Length>7.1</Length>
   </WallPiece>
-</Entity>
\ No newline at end of file
+</Entity>
Index: binaries/data/mods/public/simulation/templates/structures/spart_fortress.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/spart_fortress.xml
+++ binaries/data/mods/public/simulation/templates/structures/spart_fortress.xml
@@ -25,4 +25,8 @@
   <VisualActor>
     <Actor>structures/spartans/fortress_up.xml</Actor>
   </VisualActor>
+  <WallPiece>
+    <Length>24.0</Length>
+    <Indent>7.6</Indent>
+  </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/spart_wall_gate.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/spart_wall_gate.xml
+++ binaries/data/mods/public/simulation/templates/structures/spart_wall_gate.xml
@@ -20,6 +20,6 @@
     <Actor>structures/hellenes/wall_gate.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>38.0</Length>
+    <Length>35.4</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/spart_wall_long.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/spart_wall_long.xml
+++ binaries/data/mods/public/simulation/templates/structures/spart_wall_long.xml
@@ -17,6 +17,6 @@
     <Actor>structures/hellenes/wall_long.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>37.0</Length>
+    <Length>36.2</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/spart_wall_medium.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/spart_wall_medium.xml
+++ binaries/data/mods/public/simulation/templates/structures/spart_wall_medium.xml
@@ -20,6 +20,6 @@
     <Actor>structures/hellenes/wall_medium.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>24.0</Length>
+    <Length>24.2</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/spart_wall_short.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/spart_wall_short.xml
+++ binaries/data/mods/public/simulation/templates/structures/spart_wall_short.xml
@@ -20,6 +20,6 @@
     <Actor>structures/hellenes/wall_short.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>13.0</Length>
+    <Length>12.3</Length>
   </WallPiece>
 </Entity>
Index: binaries/data/mods/public/simulation/templates/structures/spart_wall_tower.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/structures/spart_wall_tower.xml
+++ binaries/data/mods/public/simulation/templates/structures/spart_wall_tower.xml
@@ -16,6 +16,6 @@
     <Actor>structures/hellenes/wall_tower.xml</Actor>
   </VisualActor>
   <WallPiece>
-    <Length>7.5</Length>
+    <Length>7.1</Length>
   </WallPiece>
-</Entity>
\ No newline at end of file
+</Entity>
