Index: binaries/data/mods/public/maps/random/deep_forest.js
===================================================================
--- binaries/data/mods/public/maps/random/deep_forest.js	(revision 11494)
+++ binaries/data/mods/public/maps/random/deep_forest.js	(working copy)
@@ -54,11 +54,8 @@
 var mapCenterZ = mapRadius;
 
 // Setup players and bases
-var fortresses = false;
 var numPlayers = getNumPlayers();
 var baseRadius = 20;
-if (fortresses == true)
-	baseRadius = 30;
 var minPlayerRadius = min(mapRadius-1.5*baseRadius, 5*mapRadius/8);
 var maxPlayerRadius = min(mapRadius-baseRadius, 3*mapRadius/4);
 const BUILDING_ANlE = -PI/4;
@@ -77,8 +74,6 @@
 var pathSucsessRadius = baseRadius/2;
 var pathAngleOff = PI/2;
 var pathWidth = 5; // This is not really the path's sickness in tiles but the number of tiles in the clumbs of the path
-if (fortresses == true)
-	pathSucsessRadius = baseRadius;;
 
 // Setup additional resources
 var resourceRadius = 2*mapRadius/3; // 3*mapRadius/8;
@@ -104,14 +99,6 @@
 	var placer = new ClumpPlacer(2*baseRadius*baseRadius, 2/3, 1/8, 10, x, z);
 	var painter = [new LayeredPainter([terrainBaseBorder, terrainBase], [baseRadius/4]), paintClass(clPlayer)];
 	createArea(placer, painter);
-	// Place fortresses
-	if (fortresses == true)
-	{
-		// Place fortresses
-		new wallTool(civ, "small").place(x, z, i+1, BUILDING_ANlE);
-		// if (civ == "iber")
-			// new wallTool("iber").setGenericFortress(x, z, i+1, 20, PI/6);
-	};
 	// Place starting resources
 	var distToSL = 10;
 	var resStartAngle = playerAngle[i] + PI;
@@ -266,9 +253,6 @@
 
 RMS.SetProgress(95);
 
-// Test linear wall
-// new wallTool("palisades").placeLinearWall(mapCenterX, mapCenterZ, playerStartLocX[0], playerStartLocZ[0], 0, ["tower", "wall"])
-
 
 // Export map data
 ExportMap();
Index: binaries/data/mods/public/maps/random/fortress.js
===================================================================
--- binaries/data/mods/public/maps/random/fortress.js	(revision 11494)
+++ binaries/data/mods/public/maps/random/fortress.js	(working copy)
@@ -153,31 +153,25 @@
 	// Base texture
 	var placer = new ClumpPlacer(PI*baseRadius*baseRadius/4, 1/2, 1/8, 10, playerX[i], playerZ[i]);
 	createArea(placer,[new TerrainPainter(tRoad), paintClass(clPlayer)]);
-	// Place fortresses
-	// new wallTool(civ, "medium").place(x, z, i+1, buildAngle);
 	
-	// Place fortresses Spahbod (custom fortress method, standart for this case but no function "setFortress" implemented yet)
-	var fType = new fortress('Spahbod'+civ);
+	// Place custom fortress
 	if (civ == "celt" || civ == "iber")
 	{
-		fType.wall = ['entry', 'wall', 'wall',
+		var wall = ['entryTower', 'wall', 'wall',
 			'cornerIn', 'wall', 'barracks', 'wall', 'gate', 'wall', 'house', 'wall',
-			'cornerIn', 'wall', 'house', 'wall', 'entry', 'wall', 'house', 'wall',
+			'cornerIn', 'wall', 'house', 'wall', 'entryTower', 'wall', 'house', 'wall',
 			'cornerIn', 'wall', 'house', 'wall', 'gate', 'wall', 'house', 'wall',
 			'cornerIn', 'wall', 'house', 'wall'];
 	}
 	else
 	{
-		fType.wall = ['entry', 'wall', 'wall',
+		var wall = ['entryTower', 'wall', 'wall',
 			'cornerIn', 'wall', 'barracks', 'wall', 'gate', 'wall', 'wall',
-			'cornerIn', 'wall', 'house', 'wall', 'entry', 'wall', 'wall',
+			'cornerIn', 'wall', 'house', 'wall', 'entryTower', 'wall', 'wall',
 			'cornerIn', 'wall', 'house', 'wall', 'gate', 'wall', 'wall',
 			'cornerIn', 'wall', 'house', 'wall'];
 	};
-	var fort = new wallTool(civ);
-	fort.setFortress(fType);
-	fort.place(playerX[i], playerZ[i], i+1, BUILDING_ANGlE);
-
+	placeCustomFortress(playerX[i], playerZ[i], new Fortress("Spahbod", wall), civ, i+1, BUILDING_ANGlE);
 };
 
 // create lakes
@@ -420,7 +414,7 @@
 		avoidClasses(clWater, 1, clForest, 1, clHill, 1, clPlayer, 4, clMetal, 1, clRock, 1),
 		num
 	);
-}
+};
 
 RMS.SetProgress(85);
 
@@ -459,4 +453,4 @@
 );
 
 // Export map data
-ExportMap();
\ No newline at end of file
+ExportMap();
Index: binaries/data/mods/public/maps/random/rmgen/wall_builder.js
===================================================================
--- binaries/data/mods/public/maps/random/rmgen/wall_builder.js	(revision 11494)
+++ binaries/data/mods/public/maps/random/rmgen/wall_builder.js	(working copy)
@@ -1,810 +1,568 @@
-// Functionality to create walls and fortresses
-// Wall object
-function wallElement(type)
+////////////////////////////////////////////////////////////////////
+// This file contains functionality to place walls on random maps //
+////////////////////////////////////////////////////////////////////
+
+// To do:
+// Add some more checks and warnings for example if wall elements with bending are used for linear/circular wall placement
+// Add some more documentation
+// Add further wall elements cornerHalfIn, cornerHalfOut and adjust default fortress types
+// Add wall style 'roads'
+// Add trsures to 'others'
+
+// WallElement class definition
+function WallElement(type, entity, angle, width, indent, bending)
+// argument type: Descriptive string, example: 'wall'. NOTE: Not really needed. Mainly for custom wall elements and to get the wall element type in code.
+// argument entity: Optional. Template string to be placed, example: 'structures/cart_wall'. Default is undefined (No entity placed)
+// argument angle: Optional. Placement angle so that 'outside' is 'right' (towards positive X like a unit placed with angle 0). Default is 0 (0*PI)
+// argument width: Optional. The width it lengthens the wall, width because it's the needed space in a right angle to 'outside'. Default is 0
+// argument indent: Optional. The indentation means its drawn inside (positive values) or pushed outwards (negative values). Default is 0
+// NOTE: Bending is only used for fortresses and custom walls. Linear/circular walls walls use no/generic bending
+// argument bending: Optional. How the direction of the wall is changed after this element, positive is bending 'in' (counter clockwise like entity placement)
 {
-	// NOTE: Not all wall elements have a symetry. So there's an direction 'outside' (towards top/positive Z by default)
-	// In this sense 'right'/'left' means right/left of you when you stand upon the wall and look 'outside'
-	// The wall is build towards 'right' so the next wall element will be placed right of the previous one
-	// In this sense the wall's direction is right meaning the 'bending' of a corner is used for the element following the corner
-	// With 'inside' and 'outside' defined as above, corners bend 'in'/'out' meaning placemant angle is increased/decreased (circlewise like building placement)
-	this.type = type; // Descriptive string for easy to add wall styles. Not really needed (wallTool.wallTypes['type string'] is used)
-	// Wall type documentation:
-	// wall: A blocking straight wall element that mainly lengthens the wall, self-explanatory
-	// tower: A blocking straight wall element with damage potential that slightly lengthens the wall, exsample: wall tower, palisade tower(No attack?)
-	// wallFort: A blocking straight wall element with massive damage potential that lengthens the wall, exsample: fortress, palisade fort
-		// NOTE: Not really needed but for palisades, I don't find it tragic that palisades are much less powerfull
-	// outpost: A zero-length wall element without bending far indented so it stands outside the wall, exsample: outpost, defense tower, watchtower
-	// house: A zero-length wall element without bending far indented so it stands inside the wall, exsample: house, hut, longhouse
-	// gate: A blocking straight wall element with passability determined by owner, example: gate
-	// entry: A non-blocking straight wall element represented by a single indented template, example: defense tower, wall tower, outpost, watchtower, nothing
-	// wideEntry: A non-blocking straight wall element represented by a single indented template, example: fortress? a unit?
-		// NOTE: Not really needed...
-	// endRight: A straight wall element that (only) visually ends the wall to the right (e.g. left of entrys), example: wall tower, palisade ending
-	// endLeft: A straight wall element that (only) visually ends the wall to the left (e.g. right of entrys), example: wall tower, palisade ending
-	// cornerIn: A wall element bending the wall PI/2 (90°) 'inside' (see above), example: wall tower, palisade curve
-	// cornerOut: A wall element bending the wall PI/2 (90°) 'outside' (see above), example: wall tower, palisade curve (placed the other way arround)
-	// barracks: Adding in progress...
-	this.entity = undefined; // Template (string) that will represent the wall element, example: "other/palisades_rocks_straight"
-	this.angle = -PI/2; // Placement angle so that 'outside' is 'top' (directs towards positive z, like buildings)
-	this.width = 0; // The width it lengthens the wall, width because it's the needed space in a right angle to 'outside'
-	this.indent = 0; // The indentation means its drawn inside (positive values) or pressed outwards (negative values)
-	this.bending = 0*PI; // How the angle of the wall is changed by this element for the following element, positive is bending 'in'
+	// NOTE: Not all wall elements have a symetry. So there's an direction 'outside' (towards right/positive X by default)
+	// In this sense 'left'/'right' means left/right of you when you stand upon the wall and look 'outside'
+	// The wall is build towards 'left' so the next wall element will be placed left of the previous one (towards positive Y by default)
+	// In this sense the wall's direction is left meaning the 'bending' of a corner is used for the element following the corner
+	// With 'inside' and 'outside' defined as above, corners bend 'in'/'out' meaning placemant angle is increased/decreased (counter clockwise like object placement)
+	this.type = type;
+	// Wall element type documentation:
+	// Enlengthening straight blocking (mainly left/right symetric) wall elements (Walls and wall fortifications)
+		// 'wall': A blocking straight wall element that mainly lengthens the wall, self-explanatory
+		// 'wallShort': self-explanatory. NOTE: Not implemented yet, waiting for finalized templates...
+		// 'wallLong': self-explanatory. NOTE: Not implemented yet, waiting for finalized templates...
+		// 'tower': A blocking straight wall element with damage potential (but for palisades) that slightly lengthens the wall, exsample: wall tower, palisade tower(No attack)
+		// 'wallFort': A blocking straight wall element with massive damage potential that lengthens the wall, exsample: fortress, palisade fort
+	// Enlengthening straight non/custom blocking (mainly left/right symetric) wall elements (Gates and entrys)
+		// 'gate': A blocking straight wall element with passability determined by owner, example: gate (Functionality not yet implemented)
+		// 'entry': A wall element like the gate but without an actual template or just a flag/column/obelisk
+		// 'entryTower': A non-blocking straight wall element represented by a single (maybe indented) template, example: defense tower, wall tower, outpost, watchtower
+		// 'entryFort': A non-blocking straight wall element represented by a single (maybe indented) template, example: fortress, palisade fort
+	// Enlengthening straight blocking non-left/right-symetric wall elements (Wall endings/closings)
+		// 'endLeft': A straight wall element that (only visually) finalizes the wall to the left (e.g. right of entrys), example: wall tower, palisade ending
+		// 'endRight': A straight wall element that (only visually) finalizes the wall to the right (e.g. left of entrys), example: wall tower, palisade ending
+	// Bending wall elements (Wall corners)
+		// 'cornerIn': A wall element bending the wall by PI/2 (90°) 'inside' (left, +, see above), example: wall tower, palisade curve
+		// 'cornerOut': A wall element bending the wall by PI/2 (90°) 'outside' (right, -, see above), example: wall tower, palisade curve
+		// 'cornerHalfIn': A wall element bending the wall by PI/4 (45°) 'inside' (left, +, see above), example: wall tower, palisade curve. NOTE: Not yet implemented
+		// 'cornerHalfOut': A wall element bending the wall by PI/4 (45°) 'outside' (right, -, see above), example: wall tower, palisade curve. NOTE: Not yet implemented
+	// Zero length straight indented (mainly left/right symetric) 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, exsample: outpost, defense tower, watchtower
+		// 'house': A zero-length wall element without bending far indented so it stands inside the wall that grants population bonus, exsample: house, hut, longhouse
+		// 'barracks': A zero-length wall element without bending far indented so it stands inside the wall that grants unit production, exsample: barracks, tavern, ...
+	this.entity = entity;
+	this.angle = 0*PI;
+	if (angle !== undefined)
+		this.angle = angle;
+	this.width = 0;
+	if (width !== undefined)
+		this.width = width;
+	this.indent = 0;
+	if (indent !== undefined)
+		this.indent = indent;
+	this.bending = 0*PI;
+	if (bending !== undefined)
+		this.bending = bending;
 };
 
-// Fortress object. A list would do for symetric fortresses but if 'getCenter' don't do sufficient the center can be set manually.
-function fortress(type)
+// Fortress class definition. A list would do for symetric fortresses but if 'getCenter' don't do sufficient the center can be set manually
+function Fortress(type, wall, center)
+// argument type: Descriptive string, example: 'tiny'. Not really needed (WallTool.wallTypes['type string'] is used). Mainly for custom wall elements.
+// argument wall: Optional. Array of wall element strings. Can be set afterwards. Default is an epty array.
+	// Example: ['entrance', 'wall', 'cornerIn', 'wall', 'gate', 'wall', 'entrance', 'wall', 'cornerIn', 'wall', 'gate', 'wall', 'cornerIn', 'wall']
+// argument center: Optional. Array of 2 floats determinig the vector from the center to the 1st wall element. Can be set afterwards. Default is [0, 0]. (REALLY???)
+	// NOTE: The center will be recalculated when WallTool.setFortress is called. To avoid this set WallTool.calculateCenter to false.
 {
-	this.type = type; // Only usefull to get the type of the actual fortress (by 'wallTool.fortress.type')
+	this.type = type; // Only usefull to get the type of the actual fortress (by 'WallTool.fortress.type')
 	this.wall = [];
+	if (wall !== undefined)
+		this.wall = wall;
 	this.center = [0, 0]; // X/Z offset (in default orientation) from first wall element to center, perhaps should be the other way around...
-	// NOTE: The 'angle' is not implemented yet!!!
-	this.angle = 0; // Angle the first element has to be placed so that fortress orientation is with main entrance top (default), should always be 0 though.
 };
 
-// The wall tool
-function wallTool(style, fortressType)
-{
-	// General setup
-	this.angle = 0; // Not really needed, may be useful to rotate fortresses after set...
-	this.wallTypes = {}; // An associative array including all wall elements associated with 'wallElement.type'.
-	this.wall = []; // A list of strings (wall element types) for simple wall building
-	this.center = [0, 0] // X/Z offset from first wall element to center, perhaps should be the other way around...
-	
-	// Presets needed for wall style
-	this.wallStyles = {};
-	this.style = "palisades"; // Not really needed, perhaps helpfull to check current style
-	if (style !== undefined)
-		this.style = style;
-	
-	// Presets needed for tortess types
-	this.fortressTypes = {};
-	this.fortress = false; // Not really needed, perhaps usefull for getting fortress type, should be renamed somehow but simply 'type' is not very descriptive and 'fortressType' may be mistaken as 'fortressTypes'
-	if (fortressType !== undefined)
-		this.fortress = fortressType;
-	this.calculateCenter = true; // If setFortress(Type) shall recalculate the center
-	
-	// Adding wall styles
-	// Wall style 'palisades'
-	this.wallStyles["palisades"] = {};
-	this.wallStyles["palisades"]["wall"] = new wallElement("wall");
-	this.wallStyles["palisades"]["wall"].entity = "other/palisades_rocks_straight";
-	this.wallStyles["palisades"]["wall"].angle = -PI/2;
-	this.wallStyles["palisades"]["wall"].width = 2.5;
-	
-	this.wallStyles["palisades"]["tower"] = new wallElement("tower");
-	this.wallStyles["palisades"]["tower"].entity = "other/palisades_rocks_tower";
-	this.wallStyles["palisades"]["tower"].angle = -PI/2;
-	this.wallStyles["palisades"]["tower"].width = 0.7;
-	
-	this.wallStyles["palisades"]["wallFort"] = new wallElement("wallFort");
-	this.wallStyles["palisades"]["wallFort"].entity = "other/palisades_rocks_fort";
-	this.wallStyles["palisades"]["wallFort"].angle = PI;
-	this.wallStyles["palisades"]["wallFort"].width = 1.7;
-	
-	this.wallStyles["palisades"]["outpost"] = new wallElement("outpost");
-	this.wallStyles["palisades"]["outpost"].entity = "other/palisades_rocks_outpost";
-	this.wallStyles["palisades"]["outpost"].angle = PI;
-	this.wallStyles["palisades"]["outpost"].indent = -2;
-	
-	this.wallStyles["palisades"]["house"] = new wallElement("house");
-	this.wallStyles["palisades"]["house"].entity = "other/celt_hut";
-	this.wallStyles["palisades"]["house"].angle = PI;
-	this.wallStyles["palisades"]["house"].indent = 5;
-	
-	this.wallStyles["palisades"]["gate"] = new wallElement("gate");
-	this.wallStyles["palisades"]["gate"].entity = "other/palisades_rocks_gate";
-	this.wallStyles["palisades"]["gate"].angle = -PI/2;
-	this.wallStyles["palisades"]["gate"].width = 3.6;
-	
-	this.wallStyles["palisades"]["entry"] = new wallElement("entry");
-	this.wallStyles["palisades"]["entry"].entity = "other/palisades_rocks_watchtower";
-	this.wallStyles["palisades"]["entry"].angle = 0*PI;
-	this.wallStyles["palisades"]["entry"].width = 3.6;
-	this.wallStyles["palisades"]["entry"].indent = -2;
-	
-	this.wallStyles["palisades"]["wideEntry"] = new wallElement("wideEntry");
-	this.wallStyles["palisades"]["wideEntry"].entity = "other/palisades_rocks_fort";
-	this.wallStyles["palisades"]["wideEntry"].angle = PI;
-	this.wallStyles["palisades"]["wideEntry"].width = 6;
-	this.wallStyles["palisades"]["wideEntry"].indent = -3;
-	
-	this.wallStyles["palisades"]["endRight"] = new wallElement("endRight");
-	this.wallStyles["palisades"]["endRight"].entity = "other/palisades_rocks_end";
-	this.wallStyles["palisades"]["endRight"].angle = -PI/2;
-	this.wallStyles["palisades"]["endRight"].width = 0.2;
-	
-	this.wallStyles["palisades"]["endLeft"] = new wallElement("endLeft");
-	this.wallStyles["palisades"]["endLeft"].entity = "other/palisades_rocks_end";
-	this.wallStyles["palisades"]["endLeft"].angle = PI/2;
-	this.wallStyles["palisades"]["endLeft"].width = 0.2;
-	
-	this.wallStyles["palisades"]["cornerIn"] = new wallElement("cornerIn");
-	this.wallStyles["palisades"]["cornerIn"].entity = "other/palisades_rocks_curve";
-	this.wallStyles["palisades"]["cornerIn"].angle = -PI/4;
-	this.wallStyles["palisades"]["cornerIn"].width = 2.1;
-	this.wallStyles["palisades"]["cornerIn"].indent = 0.7;
-	this.wallStyles["palisades"]["cornerIn"].bending = PI/2;
-	
-	this.wallStyles["palisades"]["cornerOut"] = new wallElement("cornerOut");
-	this.wallStyles["palisades"]["cornerOut"].entity = "other/palisades_rocks_curve";
-	this.wallStyles["palisades"]["cornerOut"].angle = PI/4;
-	this.wallStyles["palisades"]["cornerOut"].width = 2.1;
-	this.wallStyles["palisades"]["cornerOut"].indent = -0.7;
-	this.wallStyles["palisades"]["cornerOut"].bending = -PI/2;
-	
-	// Wall style 'cart'
-	this.wallStyles["cart"] = {};
-	this.wallStyles["cart"]["wall"] = new wallElement("wall");
-	this.wallStyles["cart"]["wall"].entity = "structures/cart_wall";
-	this.wallStyles["cart"]["wall"].angle = 0*PI;
-	this.wallStyles["cart"]["wall"].width = 6.2;
-	
-	this.wallStyles["cart"]["tower"] = new wallElement("tower");
-	this.wallStyles["cart"]["tower"].entity = "structures/cart_wall_tower";
-	this.wallStyles["cart"]["tower"].angle = PI;
-	this.wallStyles["cart"]["tower"].width = 2.7;
-	
-	this.wallStyles["cart"]["wallFort"] = new wallElement("wallFort");
-	this.wallStyles["cart"]["wallFort"].entity = "structures/cart_fortress";
-	this.wallStyles["cart"]["wallFort"].angle = PI;
-	this.wallStyles["cart"]["wallFort"].width = 5.1;
-	this.wallStyles["cart"]["wallFort"].indent = 1.6;
-	
-	this.wallStyles["cart"]["outpost"] = new wallElement("outpost");
-	this.wallStyles["cart"]["outpost"].entity = "structures/cart_outpost";
-	this.wallStyles["cart"]["outpost"].angle = PI;
-	this.wallStyles["cart"]["outpost"].indent = -5;
-	
-	this.wallStyles["cart"]["house"] = new wallElement("house");
-	this.wallStyles["cart"]["house"].entity = "structures/cart_house";
-	this.wallStyles["cart"]["house"].angle = PI;
-	this.wallStyles["cart"]["house"].indent = 7;
-	
-	this.wallStyles["cart"]["gate"] = new wallElement("gate");
-	this.wallStyles["cart"]["gate"].entity = "structures/cart_wall_gate";
-	this.wallStyles["cart"]["gate"].angle = 0*PI;
-	this.wallStyles["cart"]["gate"].width = 6.2;
-	
-	this.wallStyles["cart"]["entry"] = new wallElement("entry");
-	this.wallStyles["cart"]["entry"].entity = "structures/cart_defense_tower";
-	this.wallStyles["cart"]["entry"].angle = PI;
-	this.wallStyles["cart"]["entry"].width = 6.2;
-	this.wallStyles["cart"]["entry"].indent = -5;
-	
-	this.wallStyles["cart"]["wideEntry"] = new wallElement("wideEntry");
-	this.wallStyles["cart"]["wideEntry"].entity = "structures/cart_fortress";
-	this.wallStyles["cart"]["wideEntry"].angle = PI;
-	this.wallStyles["cart"]["wideEntry"].width = 12;
-	this.wallStyles["cart"]["wideEntry"].indent = 7;
-	
-	this.wallStyles["cart"]["endRight"] = new wallElement("endRight");
-	this.wallStyles["cart"]["endRight"].entity = "structures/cart_wall_tower";
-	this.wallStyles["cart"]["endRight"].angle = PI;
-	this.wallStyles["cart"]["endRight"].width = 2.7;
-	
-	this.wallStyles["cart"]["endLeft"] = new wallElement("endLeft");
-	this.wallStyles["cart"]["endLeft"].entity = "structures/cart_wall_tower";
-	this.wallStyles["cart"]["endLeft"].angle = PI;
-	this.wallStyles["cart"]["endLeft"].width = 2.7;
-	
-	this.wallStyles["cart"]["cornerIn"] = new wallElement("cornerIn");
-	this.wallStyles["cart"]["cornerIn"].entity = "structures/cart_wall_tower";
-	this.wallStyles["cart"]["cornerIn"].angle = 5*PI/4;
-	this.wallStyles["cart"]["cornerIn"].width = 0.1;
-	this.wallStyles["cart"]["cornerIn"].indent = 0.9;
-	this.wallStyles["cart"]["cornerIn"].bending = PI/2;
-	
-	this.wallStyles["cart"]["cornerOut"] = new wallElement("cornerOut");
-	this.wallStyles["cart"]["cornerOut"].entity = "structures/cart_wall_tower";
-	this.wallStyles["cart"]["cornerOut"].angle = 3*PI/4;
-	this.wallStyles["cart"]["cornerOut"].width = 1.3; // 1.6
-	this.wallStyles["cart"]["cornerOut"].bending = -PI/2;
-	
-	this.wallStyles["cart"]["barracks"] = new wallElement("barracks");
-	this.wallStyles["cart"]["barracks"].entity = "structures/cart_barracks";
-	this.wallStyles["cart"]["barracks"].angle = PI;
-	this.wallStyles["cart"]["barracks"].indent = 7;
-	
-	// Wall style 'celt'
-	this.wallStyles["celt"] = {};
-	this.wallStyles["celt"]["wall"] = new wallElement("wall");
-	this.wallStyles["celt"]["wall"].entity = "structures/celt_wall";
-	this.wallStyles["celt"]["wall"].angle = 0*PI;
-	this.wallStyles["celt"]["wall"].width = 5;
-	this.wallStyles["celt"]["wall"].indent = 0.5;
-	
-	this.wallStyles["celt"]["tower"] = new wallElement("tower");
-	this.wallStyles["celt"]["tower"].entity = "structures/celt_wall_tower";
-	this.wallStyles["celt"]["tower"].angle = PI;
-	this.wallStyles["celt"]["tower"].width = 0.7;
-	
-	this.wallStyles["celt"]["wallFort"] = new wallElement("wallFort");
-	this.wallStyles["celt"]["wallFort"].entity = "structures/celt_fortress_g";
-	this.wallStyles["celt"]["wallFort"].angle = PI;
-	this.wallStyles["celt"]["wallFort"].width = 4.2;
-	this.wallStyles["celt"]["wallFort"].indent = 2;
-	
-	this.wallStyles["celt"]["outpost"] = new wallElement("outpost");
-	this.wallStyles["celt"]["outpost"].entity = "structures/celt_outpost";
-	this.wallStyles["celt"]["outpost"].angle = PI;
-	this.wallStyles["celt"]["outpost"].indent = -5;
-	
-	this.wallStyles["celt"]["house"] = new wallElement("house");
-	this.wallStyles["celt"]["house"].entity = "structures/celt_house";
-	this.wallStyles["celt"]["house"].angle = PI;
-	this.wallStyles["celt"]["house"].indent = 5;
-	
-	this.wallStyles["celt"]["gate"] = new wallElement("gate");
-	this.wallStyles["celt"]["gate"].entity = "structures/celt_wall_gate";
-	this.wallStyles["celt"]["gate"].angle = 0*PI;
-	this.wallStyles["celt"]["gate"].width = 3.2;
-	
-	this.wallStyles["celt"]["entry"] = new wallElement("entry");
-	this.wallStyles["celt"]["entry"].entity = "structures/celt_defense_tower";
-	this.wallStyles["celt"]["entry"].angle = PI;
-	this.wallStyles["celt"]["entry"].width = 6;
-	this.wallStyles["celt"]["entry"].indent = -5;
-	
-	this.wallStyles["celt"]["wideEntry"] = new wallElement("wideEntry");
-	this.wallStyles["celt"]["wideEntry"].entity = "structures/celt_fortress_b";
-	this.wallStyles["celt"]["wideEntry"].angle = PI;
-	this.wallStyles["celt"]["wideEntry"].width = 12;
-	this.wallStyles["celt"]["wideEntry"].indent = 7;
-	
-	this.wallStyles["celt"]["endRight"] = new wallElement("endRight");
-	this.wallStyles["celt"]["endRight"].entity = "structures/celt_wall_tower";
-	this.wallStyles["celt"]["endRight"].angle = PI;
-	this.wallStyles["celt"]["endRight"].width = 0.7;
-	
-	this.wallStyles["celt"]["endLeft"] = new wallElement("endLeft");
-	this.wallStyles["celt"]["endLeft"].entity = "structures/celt_wall_tower";
-	this.wallStyles["celt"]["endLeft"].angle = PI;
-	this.wallStyles["celt"]["endLeft"].width = 0.7;
-	
-	this.wallStyles["celt"]["cornerIn"] = new wallElement("cornerIn");
-	this.wallStyles["celt"]["cornerIn"].entity = "structures/celt_wall_tower";
-	this.wallStyles["celt"]["cornerIn"].angle = PI;
-	this.wallStyles["celt"]["cornerIn"].width = 0.7;
-	this.wallStyles["celt"]["cornerIn"].indent = 0;
-	this.wallStyles["celt"]["cornerIn"].bending = PI/2;
-	
-	this.wallStyles["celt"]["cornerOut"] = new wallElement("cornerOut");
-	this.wallStyles["celt"]["cornerOut"].entity = "structures/celt_wall_tower";
-	this.wallStyles["celt"]["cornerOut"].angle = PI;
-	this.wallStyles["celt"]["cornerOut"].width = 0.7;
-	this.wallStyles["celt"]["cornerOut"].indent = 0;
-	this.wallStyles["celt"]["cornerOut"].bending = -PI/2;
-	
-	this.wallStyles["celt"]["barracks"] = new wallElement("barracks");
-	this.wallStyles["celt"]["barracks"].entity = "structures/celt_barracks";
-	this.wallStyles["celt"]["barracks"].angle = PI;
-	this.wallStyles["celt"]["barracks"].indent = 7;
-	
-	// Wall style 'hele'
-	this.wallStyles["hele"] = {};
-	this.wallStyles["hele"]["wall"] = new wallElement("wall");
-	this.wallStyles["hele"]["wall"].entity = "structures/hele_wall";
-	this.wallStyles["hele"]["wall"].angle = 0*PI;
-	this.wallStyles["hele"]["wall"].width = 5.95;
-	
-	this.wallStyles["hele"]["tower"] = new wallElement("tower");
-	this.wallStyles["hele"]["tower"].entity = "structures/hele_wall_tower";
-	this.wallStyles["hele"]["tower"].angle = PI;
-	this.wallStyles["hele"]["tower"].width = 1.5;
-	
-	this.wallStyles["hele"]["wallFort"] = new wallElement("wallFort");
-	this.wallStyles["hele"]["wallFort"].entity = "structures/hele_fortress";
-	this.wallStyles["hele"]["wallFort"].angle = 2*PI/2; // PI/2
-	this.wallStyles["hele"]["wallFort"].width = 5.1; // 5.6
-	this.wallStyles["hele"]["wallFort"].indent = 1.9; // 1.9
-	
-	this.wallStyles["hele"]["outpost"] = new wallElement("outpost");
-	this.wallStyles["hele"]["outpost"].entity = "structures/hele_outpost";
-	this.wallStyles["hele"]["outpost"].angle = PI;
-	this.wallStyles["hele"]["outpost"].indent = -5;
-	
-	this.wallStyles["hele"]["house"] = new wallElement("house");
-	this.wallStyles["hele"]["house"].entity = "structures/hele_house";
-	this.wallStyles["hele"]["house"].angle = PI/2;
-	this.wallStyles["hele"]["house"].indent = 6;
-	
-	this.wallStyles["hele"]["gate"] = new wallElement("gate");
-	this.wallStyles["hele"]["gate"].entity = "structures/hele_wall_gate";
-	this.wallStyles["hele"]["gate"].angle = 0*PI;
-	this.wallStyles["hele"]["gate"].width = 9.1;
-	
-	this.wallStyles["hele"]["entry"] = new wallElement("entry");
-	this.wallStyles["hele"]["entry"].entity = "structures/hele_defense_tower";
-	this.wallStyles["hele"]["entry"].angle = PI;
-	this.wallStyles["hele"]["entry"].width = 9.1;
-	this.wallStyles["hele"]["entry"].indent = -4;
-	
-	this.wallStyles["hele"]["wideEntry"] = new wallElement("wideEntry");
-	this.wallStyles["hele"]["wideEntry"].entity = "structures/hele_fortress";
-	this.wallStyles["hele"]["wideEntry"].angle = 5*PI/2;
-	this.wallStyles["hele"]["wideEntry"].width = 12;
-	this.wallStyles["hele"]["wideEntry"].indent = 7;
-	
-	this.wallStyles["hele"]["endRight"] = new wallElement("endRight");
-	this.wallStyles["hele"]["endRight"].entity = "structures/hele_wall_tower";
-	this.wallStyles["hele"]["endRight"].angle = PI;
-	this.wallStyles["hele"]["endRight"].width = 1.5;
-	
-	this.wallStyles["hele"]["endLeft"] = new wallElement("endLeft");
-	this.wallStyles["hele"]["endLeft"].entity = "structures/hele_wall_tower";
-	this.wallStyles["hele"]["endLeft"].angle = PI;
-	this.wallStyles["hele"]["endLeft"].width = 1.5;
-	
-	this.wallStyles["hele"]["cornerIn"] = new wallElement("cornerIn");
-	this.wallStyles["hele"]["cornerIn"].entity = "structures/hele_wall_tower";
-	this.wallStyles["hele"]["cornerIn"].angle = 5*PI/4;
-	this.wallStyles["hele"]["cornerIn"].width = 0;
-	this.wallStyles["hele"]["cornerIn"].indent = 0.5;
-	this.wallStyles["hele"]["cornerIn"].bending = PI/2;
-	
-	this.wallStyles["hele"]["cornerOut"] = new wallElement("cornerOut");
-	this.wallStyles["hele"]["cornerOut"].entity = "structures/hele_wall_tower";
-	this.wallStyles["hele"]["cornerOut"].angle = 3*PI/4;
-	this.wallStyles["hele"]["cornerOut"].width = 1;
-	this.wallStyles["hele"]["cornerOut"].bending = -PI/2;
-	
-	this.wallStyles["hele"]["barracks"] = new wallElement("barracks");
-	this.wallStyles["hele"]["barracks"].entity = "structures/hele_barracks";
-	this.wallStyles["hele"]["barracks"].angle = PI;
-	this.wallStyles["hele"]["barracks"].indent = 6;
-	
-	// Wall style 'iber'
-	this.wallStyles["iber"] = {};
-	this.wallStyles["iber"]["wall"] = new wallElement("wall");
-	this.wallStyles["iber"]["wall"].entity = "structures/iber_wall";
-	this.wallStyles["iber"]["wall"].angle = 0*PI;
-	this.wallStyles["iber"]["wall"].width = 6.9;
-	
-	this.wallStyles["iber"]["tower"] = new wallElement("tower");
-	this.wallStyles["iber"]["tower"].entity = "structures/iber_wall_tower";
-	this.wallStyles["iber"]["tower"].angle = PI;
-	this.wallStyles["iber"]["tower"].width = 2.1;
-	
-	this.wallStyles["iber"]["wallFort"] = new wallElement("wallFort");
-	this.wallStyles["iber"]["wallFort"].entity = "structures/iber_fortress";
-	this.wallStyles["iber"]["wallFort"].angle = PI;
-	this.wallStyles["iber"]["wallFort"].width = 4.5;
-	this.wallStyles["iber"]["wallFort"].indent = 0.7;
-	
-	this.wallStyles["iber"]["outpost"] = new wallElement("outpost");
-	this.wallStyles["iber"]["outpost"].entity = "structures/iber_outpost";
-	this.wallStyles["iber"]["outpost"].angle = PI;
-	this.wallStyles["iber"]["outpost"].indent = -5;
-	
-	this.wallStyles["iber"]["house"] = new wallElement("house");
-	this.wallStyles["iber"]["house"].entity = "structures/iber_house";
-	this.wallStyles["iber"]["house"].angle = PI;
-	this.wallStyles["iber"]["house"].indent = 4;
-	
-	this.wallStyles["iber"]["gate"] = new wallElement("gate");
-	this.wallStyles["iber"]["gate"].entity = "structures/iber_wall_gate";
-	this.wallStyles["iber"]["gate"].angle = 0*PI;
-	this.wallStyles["iber"]["gate"].width = 9.2;
-	
-	this.wallStyles["iber"]["entry"] = new wallElement("entry");
-	this.wallStyles["iber"]["entry"].entity = "structures/iber_wall_tower";
-	this.wallStyles["iber"]["entry"].angle = PI;
-	this.wallStyles["iber"]["entry"].width = 6.9;
-	this.wallStyles["iber"]["entry"].indent = -5;
-	
-	this.wallStyles["iber"]["wideEntry"] = new wallElement("wideEntry");
-	this.wallStyles["iber"]["wideEntry"].entity = "structures/iber_fortress";
-	this.wallStyles["iber"]["wideEntry"].angle = PI/2;
-	this.wallStyles["iber"]["wideEntry"].width = 9.2;
-	this.wallStyles["iber"]["wideEntry"].indent = 7;
-	
-	this.wallStyles["iber"]["endRight"] = new wallElement("endRight");
-	this.wallStyles["iber"]["endRight"].entity = "structures/iber_wall_tower";
-	this.wallStyles["iber"]["endRight"].angle = PI;
-	this.wallStyles["iber"]["endRight"].width = 2.1;
-	
-	this.wallStyles["iber"]["endLeft"] = new wallElement("endLeft");
-	this.wallStyles["iber"]["endLeft"].entity = "structures/iber_wall_tower";
-	this.wallStyles["iber"]["endLeft"].angle = PI;
-	this.wallStyles["iber"]["endLeft"].width = 2.1;
-	
-	this.wallStyles["iber"]["cornerIn"] = new wallElement("cornerIn");
-	this.wallStyles["iber"]["cornerIn"].entity = "structures/iber_wall_tower";
-	this.wallStyles["iber"]["cornerIn"].angle = PI;
-	this.wallStyles["iber"]["cornerIn"].width = 2.1;
-	this.wallStyles["iber"]["cornerIn"].bending = PI/2;
-	
-	this.wallStyles["iber"]["cornerIn2"] = new wallElement("cornerIn2");
-	this.wallStyles["iber"]["cornerIn2"].entity = "structures/iber_defense_tower";
-	this.wallStyles["iber"]["cornerIn2"].angle = 5*PI/4;
-	this.wallStyles["iber"]["cornerIn2"].width = 1;
-	this.wallStyles["iber"]["cornerIn2"].indent = 0.2;
-	this.wallStyles["iber"]["cornerIn2"].bending = PI/2;
-	
-	this.wallStyles["iber"]["cornerIn3"] = new wallElement("cornerIn3");
-	this.wallStyles["iber"]["cornerIn3"].entity = "structures/iber_wall_tower";
-	this.wallStyles["iber"]["cornerIn3"].angle = 5*PI/4;
-	this.wallStyles["iber"]["cornerIn3"].width = 0.3;
-	this.wallStyles["iber"]["cornerIn3"].indent = 0.5;
-	this.wallStyles["iber"]["cornerIn3"].bending = PI/2;
-	
-	this.wallStyles["iber"]["cornerOut"] = new wallElement("cornerOut");
-	this.wallStyles["iber"]["cornerOut"].entity = "structures/iber_wall_tower";
-	this.wallStyles["iber"]["cornerOut"].angle = 3*PI/4;
-	this.wallStyles["iber"]["cornerOut"].width = 1.3;
-	this.wallStyles["iber"]["cornerOut"].indent = 0;
-	this.wallStyles["iber"]["cornerOut"].bending = -PI/2;
-	
-	this.wallStyles["iber"]["barracks"] = new wallElement("barracks");
-	this.wallStyles["iber"]["barracks"].entity = "structures/iber_barracks";
-	this.wallStyles["iber"]["barracks"].angle = PI;
-	this.wallStyles["iber"]["barracks"].indent = 7;
-	
-	// Wall style 'pers'
-	this.wallStyles["pers"] = {};
-	this.wallStyles["pers"]["wall"] = new wallElement("wall");
-	this.wallStyles["pers"]["wall"].entity = "structures/pers_wall";
-	this.wallStyles["pers"]["wall"].angle = 0*PI;
-	this.wallStyles["pers"]["wall"].width = 5.9;
-	
-	this.wallStyles["pers"]["tower"] = new wallElement("tower");
-	this.wallStyles["pers"]["tower"].entity = "structures/pers_wall_tower";
-	this.wallStyles["pers"]["tower"].angle = PI;
-	this.wallStyles["pers"]["tower"].width = 1.7;
-	
-	this.wallStyles["pers"]["wallFort"] = new wallElement("wallFort");
-	this.wallStyles["pers"]["wallFort"].entity = "structures/pers_fortress";
-	this.wallStyles["pers"]["wallFort"].angle = PI;
-	this.wallStyles["pers"]["wallFort"].width = 5.6; // 5.5
-	this.wallStyles["pers"]["wallFort"].indent = 1.9; // 1.7
-	
-	this.wallStyles["pers"]["outpost"] = new wallElement("outpost");
-	this.wallStyles["pers"]["outpost"].entity = "structures/pers_outpost";
-	this.wallStyles["pers"]["outpost"].angle = PI;
-	this.wallStyles["pers"]["outpost"].indent = -5;
-	
-	this.wallStyles["pers"]["house"] = new wallElement("house");
-	this.wallStyles["pers"]["house"].entity = "structures/pers_house";
-	this.wallStyles["pers"]["house"].angle = PI;
-	this.wallStyles["pers"]["house"].indent = 6;
-	
-	this.wallStyles["pers"]["gate"] = new wallElement("gate");
-	this.wallStyles["pers"]["gate"].entity = "structures/pers_wall_gate";
-	this.wallStyles["pers"]["gate"].angle = 0*PI;
-	this.wallStyles["pers"]["gate"].width = 6;
-	
-	this.wallStyles["pers"]["entry"] = new wallElement("entry");
-	this.wallStyles["pers"]["entry"].entity = "structures/pers_defense_tower";
-	this.wallStyles["pers"]["entry"].angle = PI;
-	this.wallStyles["pers"]["entry"].width = 6;
-	this.wallStyles["pers"]["entry"].indent = -4;
-	
-	this.wallStyles["pers"]["wideEntry"] = new wallElement("wideEntry");
-	this.wallStyles["pers"]["wideEntry"].entity = "structures/pers_fortress";
-	this.wallStyles["pers"]["wideEntry"].angle = PI;
-	this.wallStyles["pers"]["wideEntry"].width = 12;
-	this.wallStyles["pers"]["wideEntry"].indent = 7;
-	
-	this.wallStyles["pers"]["endRight"] = new wallElement("endRight");
-	this.wallStyles["pers"]["endRight"].entity = "structures/pers_wall_tower";
-	this.wallStyles["pers"]["endRight"].angle = PI;
-	this.wallStyles["pers"]["endRight"].width = 1.7;
-	
-	this.wallStyles["pers"]["endLeft"] = new wallElement("endLeft");
-	this.wallStyles["pers"]["endLeft"].entity = "structures/pers_wall_tower";
-	this.wallStyles["pers"]["endLeft"].angle = PI;
-	this.wallStyles["pers"]["endLeft"].width = 1.7;
-	
-	this.wallStyles["pers"]["cornerIn"] = new wallElement("cornerIn");
-	this.wallStyles["pers"]["cornerIn"].entity = "structures/pers_wall_tower";
-	this.wallStyles["pers"]["cornerIn"].angle = 5*PI/4;
-	this.wallStyles["pers"]["cornerIn"].width = 0.2;
-	this.wallStyles["pers"]["cornerIn"].indent = 0.5;
-	this.wallStyles["pers"]["cornerIn"].bending = PI/2;
-	
-	this.wallStyles["pers"]["cornerOut"] = new wallElement("cornerOut");
-	this.wallStyles["pers"]["cornerOut"].entity = "structures/pers_wall_tower";
-	this.wallStyles["pers"]["cornerOut"].angle = 3*PI/4;
-	this.wallStyles["pers"]["cornerOut"].width = 0.8;
-	this.wallStyles["pers"]["cornerOut"].indent = 0;
-	this.wallStyles["pers"]["cornerOut"].bending = -PI/2;
-	
-	this.wallStyles["pers"]["barracks"] = new wallElement("barracks");
-	this.wallStyles["pers"]["barracks"].entity = "structures/pers_barracks";
-	this.wallStyles["pers"]["barracks"].angle = PI;
-	this.wallStyles["pers"]["barracks"].indent = 7;
-	
-	// Wall style 'rome'
-	this.wallStyles["rome"] = {};
-	this.wallStyles["rome"]["wall"] = new wallElement("wall");
-	this.wallStyles["rome"]["wall"].entity = "structures/rome_wall";
-	this.wallStyles["rome"]["wall"].angle = 0*PI;
-	this.wallStyles["rome"]["wall"].width = 5.9;
-	
-	this.wallStyles["rome"]["tower"] = new wallElement("tower");
-	this.wallStyles["rome"]["tower"].entity = "structures/rome_wall_tower";
-	this.wallStyles["rome"]["tower"].angle = PI;
-	this.wallStyles["rome"]["tower"].width = 2.1;
-	
-	this.wallStyles["rome"]["wallFort"] = new wallElement("wallFort");
-	this.wallStyles["rome"]["wallFort"].entity = "structures/rome_fortress";
-	this.wallStyles["rome"]["wallFort"].angle = PI;
-	this.wallStyles["rome"]["wallFort"].width = 6.3;
-	this.wallStyles["rome"]["wallFort"].indent = 2.1;
-	
-	this.wallStyles["rome"]["outpost"] = new wallElement("outpost");
-	this.wallStyles["rome"]["outpost"].entity = "structures/rome_outpost";
-	this.wallStyles["rome"]["outpost"].angle = PI;
-	this.wallStyles["rome"]["outpost"].indent = -5;
-	
-	this.wallStyles["rome"]["house"] = new wallElement("house");
-	this.wallStyles["rome"]["house"].entity = "structures/rome_house";
-	this.wallStyles["rome"]["house"].angle = PI;
-	this.wallStyles["rome"]["house"].indent = 7;
-	
-	this.wallStyles["rome"]["gate"] = new wallElement("gate");
-	this.wallStyles["rome"]["gate"].entity = "structures/rome_wall_gate";
-	this.wallStyles["rome"]["gate"].angle = 0*PI;
-	this.wallStyles["rome"]["gate"].width = 5.9;
-	
-	this.wallStyles["rome"]["entry"] = new wallElement("entry");
-	this.wallStyles["rome"]["entry"].entity = "structures/rome_defense_tower";
-	this.wallStyles["rome"]["entry"].angle = PI;
-	this.wallStyles["rome"]["entry"].width = 5.9;
-	this.wallStyles["rome"]["entry"].indent = -4;
-	
-	this.wallStyles["rome"]["wideEntry"] = new wallElement("wideEntry");
-	this.wallStyles["rome"]["wideEntry"].entity = "structures/rome_fortress";
-	this.wallStyles["rome"]["wideEntry"].angle = PI;
-	this.wallStyles["rome"]["wideEntry"].width = 12;
-	this.wallStyles["rome"]["wideEntry"].indent = 7;
-	
-	this.wallStyles["rome"]["endRight"] = new wallElement("endRight");
-	this.wallStyles["rome"]["endRight"].entity = "structures/rome_wall_tower";
-	this.wallStyles["rome"]["endRight"].angle = PI;
-	this.wallStyles["rome"]["endRight"].width = 2.1;
-	
-	this.wallStyles["rome"]["endLeft"] = new wallElement("endLeft");
-	this.wallStyles["rome"]["endLeft"].entity = "structures/rome_wall_tower";
-	this.wallStyles["rome"]["endLeft"].angle = PI;
-	this.wallStyles["rome"]["endLeft"].width = 2.1;
-	
-	this.wallStyles["rome"]["cornerIn"] = new wallElement("cornerIn");
-	this.wallStyles["rome"]["cornerIn"].entity = "structures/rome_wall_tower";
-	this.wallStyles["rome"]["cornerIn"].angle = 5*PI/4;
-	this.wallStyles["rome"]["cornerIn"].width = 0;
-	this.wallStyles["rome"]["cornerIn"].indent = 0.7;
-	this.wallStyles["rome"]["cornerIn"].bending = PI/2;
-	
-	this.wallStyles["rome"]["cornerOut"] = new wallElement("cornerOut");
-	this.wallStyles["rome"]["cornerOut"].entity = "structures/rome_wall_tower";
-	this.wallStyles["rome"]["cornerOut"].angle = 3*PI/4;
-	this.wallStyles["rome"]["cornerOut"].width = 1.1; // 1.4
-	this.wallStyles["rome"]["cornerOut"].indent = 0;
-	this.wallStyles["rome"]["cornerOut"].bending = -PI/2;
-	
-	this.wallStyles["rome"]["barracks"] = new wallElement("barracks");
-	this.wallStyles["rome"]["barracks"].entity = "structures/rome_barracks";
-	this.wallStyles["rome"]["barracks"].angle = PI;
-	this.wallStyles["rome"]["barracks"].indent = 6;
-	
-	// Setup some default fortress types
-	// General default fortress types
-	this.fortressTypes["tiny"] = new fortress("tiny");
-	var wallPart = ['entry', 'endLeft', 'wall', 'cornerIn', 'wall', 'endRight'];
-	var parts = 4;
-	for (var part = 0; part < parts; part++)
-	{
-		for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++)
-			this.fortressTypes["tiny"].wall.push(wallPart[wallIndex])
-	};
-	
-	this.fortressTypes["small"] = new fortress("small");
-	var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall',
-		'cornerIn', 'wall', 'tower', 'wall', 'endRight'];
-	var parts = 4;
-	for (var part = 0; part < parts; part++)
-	{
-		for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++)
-			this.fortressTypes["small"].wall.push(wallPart[wallIndex])
-	};
-	
-	this.fortressTypes["medium"] = new fortress("medium");
-	var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'cornerIn', 'wall',
-		'cornerOut', 'wall', 'cornerIn', 'wall', 'tower', 'wall', 'endRight'];
-	var parts = 4;
-	for (var part = 0; part < parts; part++)
-	{
-		for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++)
-			this.fortressTypes["medium"].wall.push(wallPart[wallIndex])
-	};
-	
-	this.fortressTypes["normal"] = new fortress("normal");
-	var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'outpost', 'wall', 'cornerIn', 'wall',
-		'cornerOut', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'tower', 'wall', 'endRight'];
-	var parts = 4;
-	for (var part = 0; part < parts; part++)
-	{
-		for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++)
-			this.fortressTypes["normal"].wall.push(wallPart[wallIndex])
-	};
-	
-	this.fortressTypes["large"] = new fortress("large");
-	var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'outpost', 'wall', 'cornerIn', 'wall', 'tower', 'wall',
-		'cornerOut', 'wall', 'tower', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'tower', 'wall', 'endRight'];
-	var parts = 4;
-	for (var part = 0; part < parts; part++)
-	{
-		for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++)
-			this.fortressTypes["large"].wall.push(wallPart[wallIndex])
-	};
-	
-	this.fortressTypes["very large"] = new fortress("very large");
-	var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'outpost', 'wall',
-		'tower', 'gate', 'tower', 'wall', 'cornerIn', 'wall', 'tower', 'wall',
-		'cornerOut', 'wall', 'tower', 'wall', 'cornerIn', 'wall', 'tower', 'gate',
-		'tower', 'wall', 'outpost', 'wall', 'tower', 'wall', 'endRight'];
-	var parts = 4;
-	for (var part = 0; part < parts; part++)
-	{
-		for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++)
-			this.fortressTypes["very large"].wall.push(wallPart[wallIndex])
-	};
-	
-	this.fortressTypes["giant"] = new fortress("giant");
-	var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'outpost', 'wall', 'tower',
-		'gate', 'tower', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'tower', 'wall',
-		'cornerOut', 'wall', 'tower', 'wall', 'outpost', 'wall', 'cornerIn', 'wall', 'tower',
-		'gate', 'tower', 'wall', 'outpost', 'wall', 'tower', 'wall', 'endRight'];
-	var parts = 4;
-	for (var part = 0; part < parts; part++)
-	{
-		for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++)
-			this.fortressTypes["giant"].wall.push(wallPart[wallIndex])
-	};
-	
-	this.fortressTypes["demo"] = new fortress("demo");
-	var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'wallFort', 'wall', 'tower', 'gate', 'tower', 'wall', 'outpost',
-		'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'endRight', 'wideEntry', 'endLeft', 'wall', 'tower', 'wall',
-		'cornerOut', 'wall', 'tower', 'wall', 'endRight', 'wideEntry', 'endLeft', 'wall', 'outpost', 'wall', 'cornerIn',
-		'wall', 'outpost', 'wall', 'tower', 'gate', 'tower', 'wall', 'wallFort', 'wall', 'tower', 'wall', 'endRight'];
-	var parts = 4;
-	for (var part = 0; part < parts; part++)
-	{
-		for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++)
-			this.fortressTypes["demo"].wall.push(wallPart[wallIndex])
-	};
-	
-	// Default civ dependent fortresses for Spahbod
-	this.fortressTypes["cartSB"] = new fortress("cartSB");
-	this.fortressTypes["cartSB"].wall = ['entry', 'wall', 'wall',
-		'cornerIn', 'wall', 'barracks', 'wall', 'gate', 'wall', 'wall',
-		'cornerIn', 'wall', 'house', 'wall', 'entry', 'wall', 'wall',
-		'cornerIn', 'wall', 'house', 'wall', 'gate', 'wall', 'wall',
-		'cornerIn', 'wall', 'house', 'wall'];
-	this.fortressTypes["celtSB"] = new fortress("celtSB");
-	this.fortressTypes["celtSB"].wall = ['entry', 'wall', 'wall',
-		'cornerIn', 'wall', 'barracks', 'wall', 'gate', 'wall', 'house', 'wall',
-		'cornerIn', 'wall', 'house', 'wall', 'entry', 'wall', 'house', 'wall',
-		'cornerIn', 'wall', 'house', 'wall', 'gate', 'wall', 'house', 'wall',
-		'cornerIn', 'wall', 'house', 'wall'];
-	this.fortressTypes["iberSB"] = this.fortressTypes["celtSB"];
-	this.fortressTypes["heleSB"] = this.fortressTypes["cartSB"];
-	this.fortressTypes["persSB"] = this.fortressTypes["cartSB"];
-	this.fortressTypes["romeSB"] = this.fortressTypes["cartSB"];
-	
-	// Setup style
-	this.setStyle(this.style);
-	
-	// Setup fortress type if preasent
-	if (this.fortress !== false && this.fortress !== undefined)
-		this.setFortressType(this.fortress);
-};
 
-wallTool.prototype.setStyle = function(style)
+// Setup data structure for some 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 while a wall style is associated with the civ string or another descriptive strings like 'palisades', 'fence', 'cart', 'celt'...
+var wallStyles = {};
+// Add civilisation wall style 'cart'
+wallStyles['cart'] = {};
+wallStyles['cart']['wall'] = new WallElement('wall', 'structures/cart_wall', 0*PI, 6.2);
+wallStyles['cart']['tower'] = new WallElement('tower', 'structures/cart_wall_tower', PI, 2.7);
+wallStyles['cart']['wallFort'] = new WallElement('wallFort', 'structures/cart_fortress', PI, 5.1, 1.6);
+wallStyles['cart']['gate'] = new WallElement('gate', 'structures/cart_wall_gate', 0*PI, 6.2);
+wallStyles['cart']['entry'] = new WallElement('entry', undefined, wallStyles['cart']['gate'].angle, wallStyles['cart']['gate'].width);
+wallStyles['cart']['entryTower'] = new WallElement('entryTower', 'structures/cart_defense_tower', PI, 6.2, -5);
+wallStyles['cart']['entryFort'] = new WallElement('entryFort', 'structures/cart_fortress', PI, 12, 7);
+wallStyles['cart']['endRight'] = new WallElement('endRight', wallStyles['cart']['tower'].entity, wallStyles['cart']['tower'].angle, wallStyles['cart']['tower'].width);
+wallStyles['cart']['endLeft'] = new WallElement('endLeft', wallStyles['cart']['tower'].entity, wallStyles['cart']['tower'].angle, wallStyles['cart']['tower'].width);
+wallStyles['cart']['cornerIn'] = new WallElement('cornerIn', 'structures/cart_wall_tower', 5*PI/4, 0, 0.8, PI/2);
+wallStyles['cart']['cornerOut'] = new WallElement('cornerOut', 'structures/cart_wall_tower', 3*PI/4, 1.3 /*1.6*/, 0, -PI/2);
+wallStyles['cart']['outpost'] = new WallElement('outpost', 'structures/cart_outpost', PI, 0, -5);
+wallStyles['cart']['house'] = new WallElement('house', 'structures/cart_house', PI, 0, 7);
+wallStyles['cart']['barracks'] = new WallElement('barracks', 'structures/cart_barracks', PI, 0, 7);
+// Add civilisation wall style 'celt'
+wallStyles['celt'] = {};
+wallStyles['celt']['wall'] = new WallElement('wall', 'structures/celt_wall', 0*PI, 5.9);
+wallStyles['celt']['tower'] = new WallElement('tower', 'structures/celt_wall_tower', PI, 1.9);
+wallStyles['celt']['wallFort'] = new WallElement('wallFort', 'structures/celt_fortress_g', PI, 4.2, 1.5);
+wallStyles['celt']['gate'] = new WallElement('gate', 'structures/celt_wall_gate', 0*PI, 5.6);
+wallStyles['celt']['entry'] = new WallElement('entry', undefined, wallStyles['celt']['gate'].angle, wallStyles['celt']['gate'].width);
+wallStyles['celt']['entryTower'] = new WallElement('entryTower', 'structures/celt_defense_tower', PI, 6, -5);
+wallStyles['celt']['entryFort'] = new WallElement('entryFort', 'structures/celt_fortress_b', PI, 8, 5);
+wallStyles['celt']['endRight'] = new WallElement('endRight', wallStyles['celt']['tower'].entity, wallStyles['celt']['tower'].angle, wallStyles['celt']['tower'].width);
+wallStyles['celt']['endLeft'] = new WallElement('endLeft', wallStyles['celt']['tower'].entity, wallStyles['celt']['tower'].angle, wallStyles['celt']['tower'].width);
+wallStyles['celt']['cornerIn'] = new WallElement('cornerIn', 'structures/celt_wall_tower', 5*PI/4, 0, 0.7, PI/2);
+wallStyles['celt']['cornerOut'] = new WallElement('cornerOut', 'structures/celt_wall_tower', 3*PI/4, 1.3, 0, -PI/2);
+wallStyles['celt']['outpost'] = new WallElement('outpost', 'structures/celt_outpost', PI, 0, -5);
+wallStyles['celt']['house'] = new WallElement('house', 'structures/celt_house', PI, 0, 3);
+wallStyles['celt']['barracks'] = new WallElement('barracks', 'structures/celt_barracks', PI, 0, 7);
+// Add civilisation wall style 'hele'
+wallStyles['hele'] = {};
+wallStyles['hele']['wall'] = new WallElement('wall', 'structures/hele_wall', 0*PI, 5.95);
+wallStyles['hele']['tower'] = new WallElement('tower', 'structures/hele_wall_tower', PI, 1.5);
+wallStyles['hele']['wallFort'] = new WallElement('wallFort', 'structures/hele_fortress', 2*PI/2 /* PI/2 */, 5.1 /* 5.6 */, 1.9 /* 1.9 */);
+wallStyles['hele']['gate'] = new WallElement('gate', 'structures/hele_wall_gate', 0*PI, 9.1);
+wallStyles['hele']['entry'] = new WallElement('entry', undefined, wallStyles['hele']['gate'].angle, wallStyles['hele']['gate'].width);
+wallStyles['hele']['entryTower'] = new WallElement('entry', 'structures/hele_defense_tower', PI, 9.1, -5);
+wallStyles['hele']['entryFort'] = new WallElement('entryFort', 'structures/hele_fortress', 5*PI/2, 12, 7);
+wallStyles['hele']['endRight'] = new WallElement('endRight', wallStyles['hele']['tower'].entity, wallStyles['hele']['tower'].angle, wallStyles['hele']['tower'].width);
+wallStyles['hele']['endLeft'] = new WallElement('endLeft', wallStyles['hele']['tower'].entity, wallStyles['hele']['tower'].angle, wallStyles['hele']['tower'].width);
+wallStyles['hele']['cornerIn'] = new WallElement('cornerIn', 'structures/hele_wall_tower', 5*PI/4, 0, 0.5, PI/2);
+wallStyles['hele']['cornerOut'] = new WallElement('cornerOut', 'structures/hele_wall_tower', 3*PI/4, 1, 0, -PI/2);
+wallStyles['hele']['outpost'] = new WallElement('outpost', 'structures/hele_outpost', PI, 0, -5);
+wallStyles['hele']['house'] = new WallElement('house', 'structures/hele_house', 3*PI/2, 0, 6);
+wallStyles['hele']['barracks'] = new WallElement('barracks', 'structures/hele_barracks', PI, 0, 6);
+// Add civilisation wall style 'iber'
+wallStyles['iber'] = {};
+wallStyles['iber']['wall'] = new WallElement('wall', 'structures/iber_wall', 0*PI, 6);
+wallStyles['iber']['tower'] = new WallElement('tower', 'structures/iber_wall_tower', PI, 1.7);
+wallStyles['iber']['wallFort'] = new WallElement('wallFort', 'structures/iber_fortress', PI, 4.6, 0.7);
+wallStyles['iber']['gate'] = new WallElement('gate', 'structures/iber_wall_gate', 0*PI, 7.9);
+wallStyles['iber']['entry'] = new WallElement('entry', undefined, wallStyles['iber']['gate'].angle, wallStyles['iber']['gate'].width);
+wallStyles['iber']['entryTower'] = new WallElement('entryTower', 'structures/iber_wall_tower', PI, 6.9, -5);
+wallStyles['iber']['entryFort'] = new WallElement('entryFort', 'structures/iber_fortress', PI/2, 12, 7);
+wallStyles['iber']['endRight'] = new WallElement('endRight', wallStyles['iber']['tower'].entity, wallStyles['iber']['tower'].angle, wallStyles['iber']['tower'].width);
+wallStyles['iber']['endLeft'] = new WallElement('endLeft', wallStyles['iber']['tower'].entity, wallStyles['iber']['tower'].angle, wallStyles['iber']['tower'].width);
+wallStyles['iber']['cornerIn'] = new WallElement('cornerIn', 'structures/iber_wall_tower', 5*PI/4, 1.7, 0, PI/2);
+wallStyles['iber']['cornerOut'] = new WallElement('cornerOut', 'structures/iber_wall_tower', 3*PI/4, 1.7, 0, -PI/2);
+wallStyles['iber']['outpost'] = new WallElement('outpost', 'structures/iber_outpost', PI, 0, -5);
+wallStyles['iber']['house'] = new WallElement('house', 'structures/iber_house', PI, 0, 4);
+wallStyles['iber']['barracks'] = new WallElement('barracks', 'structures/iber_barracks', PI, 0, 7);
+// Add civilisation wall style 'pers'
+wallStyles['pers'] = {};
+wallStyles['pers']['wall'] = new WallElement('wall', 'structures/pers_wall', 0*PI, 5.9);
+wallStyles['pers']['tower'] = new WallElement('tower', 'structures/pers_wall_tower', PI, 1.7);
+wallStyles['pers']['wallFort'] = new WallElement('wallFort', 'structures/pers_fortress', PI, 5.6/*5.5*/, 1.9/*1.7*/);
+wallStyles['pers']['gate'] = new WallElement('gate', 'structures/pers_wall_gate', 0*PI, 6);
+wallStyles['pers']['entry'] = new WallElement('entry', undefined, wallStyles['pers']['gate'].angle, wallStyles['pers']['gate'].width);
+wallStyles['pers']['entryTower'] = new WallElement('entry', 'structures/pers_defense_tower', PI, 6, -5);
+wallStyles['pers']['entryFort'] = new WallElement('entryFort', 'structures/pers_fortress', PI, 12, 7);
+wallStyles['pers']['endRight'] = new WallElement('endRight', wallStyles['pers']['tower'].entity, wallStyles['pers']['tower'].angle, wallStyles['pers']['tower'].width);
+wallStyles['pers']['endLeft'] = new WallElement('endLeft', wallStyles['pers']['tower'].entity, wallStyles['pers']['tower'].angle, wallStyles['pers']['tower'].width);
+wallStyles['pers']['cornerIn'] = new WallElement('cornerIn', 'structures/pers_wall_tower', 5*PI/4, 0.2, 0.5, PI/2);
+wallStyles['pers']['cornerOut'] = new WallElement('cornerOut', 'structures/pers_wall_tower', 3*PI/4, 0.8, 0, -PI/2);
+wallStyles['pers']['outpost'] = new WallElement('outpost', 'structures/pers_outpost', PI, 0, -5);
+wallStyles['pers']['house'] = new WallElement('house', 'structures/pers_house', PI, 0, 6);
+wallStyles['pers']['barracks'] = new WallElement('barracks', 'structures/pers_barracks', PI, 0, 7);
+// Add civilisation wall style 'rome'
+wallStyles['rome'] = {};
+wallStyles['rome']['wall'] = new WallElement('wall', 'structures/rome_wall', 0*PI, 5.9);
+wallStyles['rome']['tower'] = new WallElement('tower', 'structures/rome_wall_tower', PI, 2.1);
+wallStyles['rome']['wallFort'] = new WallElement('wallFort', 'structures/rome_fortress', PI, 6.3, 2.1);
+wallStyles['rome']['gate'] = new WallElement('gate', 'structures/rome_wall_gate', 0*PI, 5.9);
+wallStyles['rome']['entry'] = new WallElement('entry', undefined, wallStyles['rome']['gate'].angle, wallStyles['rome']['gate'].width);
+wallStyles['rome']['entryTower'] = new WallElement('entryTower', 'structures/rome_defense_tower', PI, 5.9, -5);
+wallStyles['rome']['entryFort'] = new WallElement('entryFort', 'structures/rome_fortress', PI, 12, 7);
+wallStyles['rome']['endRight'] = new WallElement('endRight', wallStyles['rome']['tower'].entity, wallStyles['rome']['tower'].angle, wallStyles['rome']['tower'].width);
+wallStyles['rome']['endLeft'] = new WallElement('endLeft', wallStyles['rome']['tower'].entity, wallStyles['rome']['tower'].angle, wallStyles['rome']['tower'].width);
+wallStyles['rome']['cornerIn'] = new WallElement('cornerIn', 'structures/rome_wall_tower', 5*PI/4, 0, 0.7, PI/2);
+wallStyles['rome']['cornerOut'] = new WallElement('cornerOut', 'structures/rome_wall_tower', 3*PI/4, 1.1, 0, -PI/2);
+wallStyles['rome']['outpost'] = new WallElement('outpost', 'structures/rome_outpost', PI, 0, -5);
+wallStyles['rome']['house'] = new WallElement('house', 'structures/rome_house', PI, 0, 7);
+wallStyles['rome']['barracks'] = new WallElement('barracks', 'structures/rome_barracks', PI, 0, 6);
+// Add special wall style 'romeSiege'
+wallStyles['romeSiege'] = {};
+wallStyles['romeSiege']['wall'] = new WallElement('wall', 'structures/rome_siege_wall', 0*PI, 6.2);
+wallStyles['romeSiege']['tower'] = new WallElement('tower', 'structures/rome_siege_wall_tower', PI, 0);
+wallStyles['romeSiege']['wallFort'] = new WallElement('wallFort', 'structures/rome_army_camp', PI, 7.2, 2);
+wallStyles['romeSiege']['gate'] = new WallElement('gate', 'structures/rome_siege_wall_gate', 0*PI, 5.9);
+wallStyles['romeSiege']['entry'] = new WallElement('entry', undefined, wallStyles['romeSiege']['gate'].angle, wallStyles['romeSiege']['gate'].width);
+wallStyles['romeSiege']['entryTower'] = new WallElement('entryTower', 'structures/rome_defense_tower', PI, 5.9, -4);
+wallStyles['romeSiege']['entryFort'] = new WallElement('entryFort', 'structures/rome_army_camp', PI, 12, 7);
+wallStyles['romeSiege']['endRight'] = new WallElement('endRight', wallStyles['romeSiege']['tower'].entity, wallStyles['romeSiege']['tower'].angle, wallStyles['romeSiege']['tower'].width);
+wallStyles['romeSiege']['endLeft'] = new WallElement('endLeft', wallStyles['romeSiege']['tower'].entity, wallStyles['romeSiege']['tower'].angle, wallStyles['romeSiege']['tower'].width);
+wallStyles['romeSiege']['cornerIn'] = new WallElement('cornerIn', 'structures/rome_defense_tower', 5*PI/4, 0.1, 0.3, PI/2);
+wallStyles['romeSiege']['cornerIn2'] = new WallElement('cornerIn2', undefined, 5*PI/4, -1.6, 0, PI/2); // Grafic glitch
+wallStyles['romeSiege']['cornerOut'] = new WallElement('cornerOut', 'structures/rome_siege_wall_tower', 3*PI/4, 1.4, -0.2, -PI/2);
+wallStyles['romeSiege']['outpost'] = new WallElement('outpost', 'structures/rome_outpost', PI, 0, -5);
+wallStyles['romeSiege']['house'] = new WallElement('house', 'structures/rome_tent', PI, 0, 4);
+wallStyles['romeSiege']['barracks'] = new WallElement('barracks', 'structures/rome_barracks', PI, 0, 6);
+// Add special wall style 'palisades'
+wallStyles['palisades'] = {};
+wallStyles['palisades']['wall'] = new WallElement('wall', 'other/palisades_rocks_straight', -PI/2, 2.5);
+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', 0*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, 3.6, -2);
+wallStyles['palisades']['entryFort'] = new WallElement('entryFort', 'other/palisades_rocks_fort', PI, 6, 3);
+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);
+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', 'other/celt_tavern', PI, 0, 5);
+// Add special wall style 'road'
+// 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_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);
+
+
+// Setup data structure for some default fortress types
+// A fortress type is just an instance of the fortress class with actually something in it.
+// fortressTypes holds all the fortressess within an associative array while a fortress is associated with a descriptive string maching the map sizes, example: 'tiny', 'giant'
+var fortressTypes = {};
+// Setup some default fortress types
+// Add fortress type 'tiny'
+fortressTypes['tiny'] = new Fortress('tiny');
+var wallPart = ['entry', 'endLeft', 'wall', 'cornerIn', 'wall', 'endRight'];
+fortressTypes['tiny'].wall = wallPart.concat(wallPart, wallPart, wallPart);
+// Add fortress type 'small'
+fortressTypes['small'] = new Fortress('small');
+var wallPart = ['entry', 'endLeft', 'wall', 'outpost', 'wall',
+	'cornerIn', 'wall', 'outpost', 'wall', 'endRight'];
+fortressTypes['small'].wall = wallPart.concat(wallPart, wallPart, wallPart);
+// Add fortress type 'medium'
+fortressTypes['medium'] = new Fortress('medium');
+var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall',
+	'cornerIn', 'wall', 'tower', 'wall', 'endRight'];
+fortressTypes['medium'].wall = wallPart.concat(wallPart, wallPart, wallPart);
+// Add fortress type 'normal'
+fortressTypes['normal'] = new Fortress('normal');
+var wallPart = ['entry', 'endLeft', 'wall', 'outpost', 'wall', 'cornerIn', 'wall',
+	'cornerOut', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'endRight'];
+fortressTypes['normal'].wall = wallPart.concat(wallPart, wallPart, wallPart);
+// Add fortress type 'large'
+fortressTypes['large'] = new Fortress('large');
+var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'cornerIn', 'wall',
+	'cornerOut', 'wall', 'cornerIn', 'wall', 'tower', 'wall', 'endRight'];
+fortressTypes['large'].wall = wallPart.concat(wallPart, wallPart, wallPart);
+// Add fortress type 'veryLarge'
+fortressTypes['veryLarge'] = new Fortress('veryLarge');
+var wallPart = ['entry', 'endLeft', 'wall', 'outpost', 'wall', 'cornerIn', 'wall', 'outpost', 'wall',
+	'cornerOut', 'wall', 'outpost', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'endRight'];
+fortressTypes['veryLarge'].wall = wallPart.concat(wallPart, wallPart, wallPart);
+// Add fortress type 'giant'
+fortressTypes['giant'] = new Fortress('giant');
+var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'cornerIn', 'wall', 'tower', 'wall',
+	'cornerOut', 'wall', 'tower', 'wall', 'cornerIn', 'wall', 'tower', 'wall', 'endRight'];
+fortressTypes['giant'].wall = wallPart.concat(wallPart, wallPart, wallPart);
+
+// Setup some semi default fortresses for 'palisades' style
+var fortressTypeKeys = ['tiny', 'small', 'medium', 'normal', 'large', 'veryLarge', 'giant']
+for (var i = 0; i < fortressTypeKeys.length; i++)
 {
-	if (style in this.wallStyles)
-	{
-		this.style = style;
-		this.wallTypes = this.wallStyles[style];
-	}
-	else
+	var newKey = fortressTypeKeys[i] + 'Palisades';
+	var oldWall = fortressTypes[fortressTypeKeys[i]].wall;
+	fortressTypes[newKey] = new Fortress(newKey, []); // [] just to make sure it's an array though it's an array by default
+	var fillTowersBetween = ['wall', 'endLeft', 'endRight', 'cornerIn', 'cornerOut'];
+	for (var j = 0; j < oldWall.length; j++)
 	{
-		warn("Wall style '" + style + "' not found, falling back to 'palisades'...");
-		this.style = 'palisades';
-		this.wallTypes = this.wallStyles['palisades'];
+		fortressTypes[newKey].wall.push(oldWall[j]); // Only works if the first element is an entry or gate (not in fillTowersBetween)
+		if (j+1 < oldWall.length)
+			if (fillTowersBetween.indexOf(oldWall[j]) > -1 && fillTowersBetween.indexOf(oldWall[j+1]) > -1) // ... > -1 means 'exsists' here
+				fortressTypes[newKey].wall.push('tower');
 	};
 };
 
-wallTool.prototype.getAlignment = function(startX, startZ, orientation)
+
+// Define the abstract getWallAlignment and getWallCenter function
+
+// Get alignment of a wall 
+// Returns a list of lists of most arguments needed to place the different wall elements for a given wall
+// Placing the first wall element at startX/startY placed with angle given by orientation
+// An alignement can be used to get the center of a 'wall' (more likely used for closed walls like fortresses) with the getWallCenter function
+function getWallAlignment(startX, startY, wall, style, orientation)
 {
-	if (startX == undefined)
-		startX = 0;
-	if (startZ == undefined)
-		startZ = 0;
 	if (orientation == undefined)
 		orientation = 0;
-	var wallAlignment = [];
-	var outside = orientation;
-	var wallX = startX - this.center[1]*sin(orientation) - this.center[0]*cos(orientation);
-	var wallZ = startZ - this.center[1]*cos(orientation) + this.center[0]*sin(orientation);
-	for (var iWall = 0; iWall < this.wall.length; iWall++)
+	var alignment = []
+	var wallX = startX;
+	var wallY = startY;
+	for (var i = 0; i < wall.length; i++)
 	{
-		var element = this.wallTypes[this.wall[iWall]];
-		var x = wallX - element.indent*sin(outside);
-		var z = wallZ - element.indent*cos(outside);
-		wallAlignment.push([x, z, element.entity, outside + element.angle]);
-		// Presets for the next element
-		if (iWall + 1 < this.wall.length)
+		if (wallStyles[style][wall[i]] == undefined)
+			warn('No valid wall element: ' + wall[i]);
+		var element = wallStyles[style][wall[i]]
+		// Indentation
+		var placeX = wallX - element.indent * cos(orientation);
+		var placeY = wallY - element.indent * sin(orientation);
+		// Add element alignment
+		alignment.push([placeX, placeY, element.entity, orientation + element.angle]);
+		// Preset vars for the next wall element
+		if (i+1 < wall.length)
 		{
-			outside += element.bending;
-			var nextElement = this.wallTypes[this.wall[iWall + 1]];
+			orientation += element.bending;
+			if (wallStyles[style][wall[i+1]] == undefined)
+				warn('No valid wall element: ' + wall[i+1]);
+			var nextElement = wallStyles[style][wall[i+1]];
 			var distance = (element.width + nextElement.width)/2;
-			// Indent corrections for corners
+			// Corrections for elements with indent AND bending
 			if (element.bending !== 0 && element.indent !== 0)
 			{
-				// Indent correction of distance, not sure for non-right angles...
+				// Indent correction to adjust distance
 				distance += element.indent*sin(element.bending);
-				// Indent correction of next normalized indentation
-				wallX += element.indent * sin(outside);
-				wallZ += element.indent * cos(outside);
+				// Indent correction to normalize indentation
+				wallX += element.indent * cos(orientation);
+				wallY += element.indent * sin(orientation);
 			};
-			wallX += distance * sin(outside + PI/2);
-			wallZ += distance * cos(outside + PI/2);
+			// Set the next coordinates of the next element in the wall (meaning without indentation adjustment)
+			wallX -= distance * sin(orientation);
+			wallY += distance * cos(orientation);
 		};
 	};
-	return wallAlignment
+	return alignment;
 };
 
-wallTool.prototype.getCenter = function(wallAlignment)
+// Get the center of a wall (mainly usefull for closed walls like fortresses)
+// Center calculation works like getting the center of mass assuming all wall elements have the same 'waight'
+// It returns the vector (array [x, y]) from the first wall element to the center
+// So if used to preset the center in an instance of the fortress class use the negative values (I think)
+function getWallCenter(alignment)
 {
 	var x = 0;
-	var z = 0;
-	for (var iWall = 0; iWall < wallAlignment.length; iWall++)
+	var y = 0;
+	for (var i = 0; i < alignment.length; i++)
+	{
+		x += alignment[i][0]/alignment.length;
+		y += alignment[i][1]/alignment.length;
+	};
+	var center = [x, y];
+	return center;
+};
+
+
+// Define the different wall placer functions
+
+// Place simple wall starting with the first wall element placed at startX/startY
+function placeWall(startX, startY, wall, style, playerId, orientation)
+// orientation: 0 means 'outside' or 'front' of the wall is right (positive X) like placeObject
+// 	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
+{
+	var AM = getWallAlignment(startX, startY, wall, style, orientation);
+	for (var iWall = 0; iWall < wall.length; iWall++)
 	{
-		x += wallAlignment[iWall][0]/wallAlignment.length;
-		z += wallAlignment[iWall][1]/wallAlignment.length;
+		if (AM[iWall][2] !== undefined)
+			placeObject(AM[iWall][0], AM[iWall][1], AM[iWall][2], playerId, AM[iWall][3]);
 	};
-	var output = [x, z];
-	return output;
 };
 
-wallTool.prototype.setFortress = function(fortress)
+// Place a fortress (mainly a closed wall build like placeWall) with the center at centerX/centerY
+// Should always start with the main entrance (like 'entry' or 'gate') to get the orientation right (like placeObject)
+function placeCustomFortress(centerX, centerY, fortress, style, playerId, orientation, scipGetCenter)
 {
-	this.fortress = fortress.type;
-	this.wall = fortress.wall;
-	if (this.calculateCenter == true)
+	if (scipGetCenter == undefined)
+		scipGetCenter = false;
+	if (scipGetCenter == false)
 	{
-		this.center = [0, 0];
-		var AM = this.getAlignment(0, 0, 0*PI);
-		var center = this.getCenter(AM);
-		this.center = center;
+		var alignment = getWallAlignment(0, 0, fortress.wall, style);
+		var center = getWallCenter(alignment);
+		var startX = centerX - center[0] * cos(orientation) - center[1] * sin(orientation);
+		var startY = centerY - center[1] * cos(orientation) - center[0] * sin(orientation);
 	}
 	else
 	{
-		this.center = this.fortress.center
+		var startX = centerX + fortress.center[0];
+		var startY = centerY + fortress.center[1];
 	};
+	placeWall(startX, startY, fortress.wall, style, playerId, orientation)
 };
 
-wallTool.prototype.setFortressType = function(type)
+function placeFortress(centerX, centerY, type, style, playerId, orientation, scipGetCenter)
+	placeCustomFortress(centerX, centerY, fortressTypes[type], style, playerId, orientation, scipGetCenter);
+
+// Place a linear wall of repeatant wall elements given in the argument wallPart from startX/startY to targetX/targetY
+// This method has no clearly defined 'inside' or 'outside' so no indentation supported yet (see below)
+function placeLinearWall(startX, startY, targetX, targetY, wallPart, style, playerId, endWithFirst)
+// startX: x coordinate of the beginning of the wall
+// startY: y coordinate of the beginning of the wall
+// targetX: x coordinate of the ending of the wall
+// targetY: y coordinate of the ending of the wall
+// NOTE: Start and target coordinates are exact (besides the scale offset) meaning the wall will begin/end at the given coordinates (not the first/last entity is placed there)
+// wallPart: Optional. An array of wall element type strings (see WallElement.type). Default is ['wall']
+// NOTE: Don't use wall elements with bending like corners!
+// style: Optional. An wall style string (like defined in the 'wallStyles' dictionary). Default is 'palisades'
+// playerId: Optional. The walls owners player ID (like in the function 'placeObject' so 0 is gaia, 1 is the first 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
 {
-	if (type in this.fortressTypes)
-	{
-		this.setFortress(this.fortressTypes[type]);
-	}
+	// Setup optional arguments to the default
+	if (wallPart == undefined)
+		wallPart = ['wall'];
+	if (style == undefined)
+		style = 'palisades';
+	if (playerId == undefined)
+		playerId = 0;
+	if (endWithFirst == undefined)
+		endWithFirst = true;
+	// 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 numParts = 0;
+	if (endWithFirst == true)
+		numParts = ceil((totalLength - wallStyles[style][wallPart[0]].width) / wallPartLength)
 	else
+		numParts = ceil(totalLength / wallPartLength);
+	// Setup scale factor
+	var scaleFactor = 1;
+	if (endWithFirst == true)
+		scaleFactor = totalLength / (numParts * wallPartLength + wallStyles[style][wallPart[0]].width)
+	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 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);
+			// Indent correction
+			var placeX = x - wallEle.indent * sin(wallAngle);
+			var placeY = y + wallEle.indent * cos(wallAngle);
+			// Placement
+			if (wallEle.entity !== undefined)
+				placeObject(placeX, placeY, wallEle.entity, playerId, placeAngle + wallEle.angle);
+			x += scaleFactor * wallEle.width/2 * cos(wallAngle);
+			y += scaleFactor * wallEle.width/2 * sin(wallAngle);
+		};
+	};
+	if (endWithFirst == true)
 	{
-		warn("Fortress type '" + type + "' not found, falling back to 'medium'");
-		this.setFortress(this.fortressTypes["medium"]);
+		var wallEle = wallStyles[style][wallPart[0]];
+		x += scaleFactor * wallEle.width/2 * cos(wallAngle);
+		y += scaleFactor * wallEle.width/2 * sin(wallAngle);
+		if (wallEle.entity !== undefined)
+			placeObject(x, y, wallEle.entity, playerId, placeAngle + wallEle.angle);
 	};
 };
 
-wallTool.prototype.place = function(startX, startZ, playerId, orientation)
+// Place a circular wall of repeatant wall elements given in the argument wallPart arround centerX/centerY with the given radius
+// The wall is not necessarily closed depending on the optional argument maxAngle (better name?)
+function placeCircularWall(centerX, centerY, radius, wallPart, style, playerId, orientation, maxAngle, endWithFirst, maxBendOff)
+// NOTE: Don't use wall elements with bending like corners!
 {
-	var AM = this.getAlignment(startX, startZ, orientation);
-	for (var iWall = 0; iWall < this.wall.length; iWall++)
+	// Setup optional arguments to the default
+	if (wallPart == undefined)
+		wallPart = ['wall'];
+	if (style == undefined)
+		style = 'palisades';
+	if (playerId == undefined)
+		playerId = 0;
+	if (orientation == undefined)
+		orientation = 0;
+	if (maxAngle == undefined)
+		maxAngle = 2*PI;
+	if (endWithFirst == undefined)
 	{
-		if (AM[iWall][2] !== undefined)
-			placeObject(AM[iWall][0], AM[iWall][1], AM[iWall][2], playerId, AM[iWall][3]);
+		if (maxAngle >= 2*PI - 0.001) // Can this be done better?
+		{
+			endWithFirst = false;
+		}
+		else
+		{
+			endWithFirst = true;
+		};
+	};
+	if (maxBendOff == undefined)
+		maxBendOff = 0;
+	if (maxBendOff > PI/2 || maxBendOff < 0)
+		warn('placeCircularWall maxBendOff sould satisfy 0 < maxBendOff < PI/2 (~1.5) but it is: ' + maxBendOff);
+	// 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 numParts = 0;
+	if (endWithFirst == true)
+	{
+		numParts = ceil((totalLength - wallStyles[style][wallPart[0]].width) / wallPartLength);
+	}
+	else
+	{
+		numParts = ceil(totalLength / wallPartLength);
+	};
+	// Setup scale factor
+	var scaleFactor = 1;
+	if (endWithFirst == true)
+		scaleFactor = totalLength / (numParts * wallPartLength + wallStyles[style][wallPart[0]].width)
+	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 (var elementIndex = 0; elementIndex < wallPart.length; elementIndex++)
+		{
+			var wallEle = wallStyles[style][wallPart[elementIndex]];
+			// 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;
+			// Indent correction
+			placeX -= wallEle.indent * cos(placeAngle);
+			placeY -= wallEle.indent * sin(placeAngle);
+			// Placement
+			if (wallEle.entity !== undefined)
+				placeObject(placeX, placeY, wallEle.entity, playerId, placeAngle + wallEle.angle);
+			// Prepare for the next wall element
+			actualAngle += addAngle;
+			x = centerX + radius*cos(actualAngle);
+			y = centerY + radius*sin(actualAngle);
+		};
+	};
+	if (endWithFirst == true)
+	{
+		var wallEle = wallStyles[style][wallPart[0]];
+		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;
+		placeObject(placeX, placeY, wallEle.entity, playerId, placeAngle + wallEle.angle);
 	};
 };
Index: binaries/data/mods/public/maps/random/wall_demo.js
===================================================================
--- binaries/data/mods/public/maps/random/wall_demo.js	(revision 0)
+++ binaries/data/mods/public/maps/random/wall_demo.js	(working copy)
@@ -0,0 +1,153 @@
+RMS.LoadLibrary("rmgen");
+
+// initialize map
+log("Initializing map...");
+InitMap();
+
+
+// General map setup
+var mapSize = getMapSize();
+var mapCenterX = mapSize/2;
+var mapCenterY = mapSize/2;
+const BUILDING_ANlE = -PI/4;
+
+
+////////////////////////////////////////
+// Demonstration code for wall placement
+////////////////////////////////////////
+
+// Some general notes to the arguments:
+
+// First all the place functions take the coordinates needed to place the wall
+// X and Y coordinate are taken in seperate arguments like in placeObject
+// Their meaning differs for different placement methods but are mainly self explanatory
+// placeLinearWall takes 4 arguments here (2 coordinates) for startX, startY, targetX and targetY
+
+// The next argument is always the 'wall' definition, an array of wall element type strings in most cases
+// That looks like ['endLeft', 'wall', 'tower', 'wall', 'endRight', 'entry', 'endLeft', 'wall', 'tower', 'wall', 'endRight']
+// For placeCircularWall and placeLinearWall only wall parts are needed like: ['tower', 'wall']
+// They will automatically end with the first wall element if that makes sense (e.g. the wall is not closed)
+// NOTE: They take further optional arguments to adjust this behaviour (See the wall_builder.js for that)
+// placeFortress just takes a fortress type string that includes the wall definition
+// The default fortress type strings are made for easy placement of predefined fortresses
+// They are chosen like map sizes: 'tiny', 'small', 'medium', 'normal', 'large', 'veryLarge' and 'giant'
+// NOTE: To place a custom fortress use placeCustomFortress instead
+// It takes an instance of the Fortress class instead of the default fortress type strings
+
+// The next argument is always the wall style string
+// Wall styles are chosen by strings so the civ strings got by g_MapSettings.PlayerData[playerId - 1].Civ can be used
+// Other styles may be present as well but besides the civ styles only 'palisades' includes all wall element types (yet)
+
+// The next argument is always the index of the player that owns the wall.
+// 0 is Gaia, 1 is Player 1 (default colour blue), 2 is Player 2 (default colour red), ...
+
+// The next argument is an angle defining the orientation of the wall
+// placeLinearWall does not need an angle since it's defined by startX/Y and targetX/Y
+// Orientation works like the angle argument in placeObject
+// 0 is always right (towards positive X)
+// Raising the angle will rotate the wall counter-clockwise (mathmatical positive in default 2D)
+// PI/2 faces top (positive Y)
+// Orientation might be a little confusing for placeWall since it defines where the wall has its 'front' or 'outside' not the direction it will be build to.
+// It's because all other methods work like that and it's intuitive there
+// That means the walls outside by default (orientation = 0) faces positive X and (without bending wall elements) will be build towards positive Y
+
+// Some other arguments are taken but all of them are optional and in most cases not needed
+// One example is maxAngle for placeCircularWall that defines how far the wall will circumvent the center.
+// Default is 2*PI which makes a full circle
+
+
+// General wall placement setup
+const distToMapBorder = 5;
+const distToOtherWalls = 5;
+var buildableMapSize = mapSize - 2 * distToMapBorder;
+var actualX = distToMapBorder;
+var actualY = distToMapBorder;
+// Wall styles are chosen by strings so the civ strings got by g_MapSettings.PlayerData[playerId - 1].Civ 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 = ['cart', 'celt', 'hele', 'iber', 'pers', 'rome', 'romeSiege', 'palisades'];
+
+
+////////////////////////////////////////
+// Custom wall placement (element based)
+////////////////////////////////////////
+var wall = ['endLeft', 'wall', 'tower', 'wall', 'outpost', 'wall', 'cornerOut', 'wall', 'cornerIn', 'wall', 'house', 'endRight', 'entryTower', 'endLeft', 'wall', 'barracks', 'gate', 'tower', 'wall', 'wallFort', 'wall', 'endRight'];
+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', 'celt', 'hele', 'iber', 'pers', 'rome', 'romeSiege' or 'palisades'
+	var orientation = styleIndex * PI/32; // Orientation of the first wall element. 0 means 'outside' or 'front' is right (positive X, like object placement)
+	// 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 colour blue), ...
+	placeWall(startX, startY, wall, style, playerId, orientation); // Actually placing 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++)
+{
+	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
+	var type = 'tiny'; // Default fortress types are like map sizes: 'tiny', 'small', 'medium', 'large', 'veryLarge', 'giant'
+	var style = wallStyleList[styleIndex]; // The wall's style like 'cart', 'celt', 'hele', 'iber', 'pers', 'rome', 'romeSiege' or 'palisades'
+	var playerId = 0; // Owner of the wall. 0 is Gaia, 1 is Player 1 (default colour blue), ...
+	var orientation = styleIndex * PI/16; // Where the 'main entrance' of the fortress should face (like in placeObject). All fortresses walls should start with an entrance
+	placeFortress(centerX, centerY, type, style, playerId, orientation); // Actually placing 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 * fortressRadius + 2 * distToOtherWalls; // Increase actualY for next wall placement method
+
+//////////////////////////
+// Circular 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 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 or 360°, see below. Otherwise where the first wall element 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 wallPart = ['tower', 'wall', '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', 'celt', 'hele', '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
+	placeObject(centerX, centerY, 'other/obelisk', 0, 0*PI); // Place visual marker to see the center of the wall circle
+	orientation += PI/4; // 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 wallIndex = 0; wallIndex < numWallsPerStyle; wallIndex++)
+	{
+		var startX = actualX + (styleIndex * numWallsPerStyle + wallIndex) * distToOtherWalls; // X coordinate the wall will start from
+		var startY = actualY; // Y coordinate the wall will start from
+		var endX = actualX + (styleIndex * numWallsPerStyle + wallIndex) * distToOtherWalls; // 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 style = wallStyleList[styleIndex]; // The wall's style like 'cart', 'celt', 'hele', '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
+ExportMap();
Index: binaries/data/mods/public/maps/random/wall_demo.json
===================================================================
--- binaries/data/mods/public/maps/random/wall_demo.json	(revision 0)
+++ binaries/data/mods/public/maps/random/wall_demo.json	(working copy)
@@ -0,0 +1,12 @@
+{
+	"settings" : {
+		"Name" : "Wall Demo",
+		"Script" : "wall_demo.js",
+		"Description" : "A demonstration of wall placement methods/code in random maps. Medium map size is recommended.",
+		"BaseTerrain" : ["grass1"],
+		"BaseHeight" : 0,
+		"Keywords": ["demo"],
+		"CircularMap" : false,
+		"XXXXXX" : "Optionally define other things here, like we would for a scenario"
+	}
+}
\ No newline at end of file
