From 1c5a7f62676d2674c34dc0ab50dcafd050daf894 Mon Sep 17 00:00:00 2001 From: FeXoR Date: Thu, 19 May 2016 14:48:21 +0000 Subject: [PATCH] Moved BUILDING_ANGlE from the maps to BUILDING_ORIENTATION in a random map lib. Made some arguments optional with the default set to that constant, renamed some arguments and moved "orientation" in placeCivDefaultEntities to kwargs. Removed unneeded comments. Fixes #3988 This was SVN commit r18198. --- .../mods/public/maps/random/aegean_sea.js | 4 +--- .../mods/public/maps/random/alpine_lakes.js | 4 +--- .../mods/public/maps/random/alpine_valley.js | 4 +--- .../public/maps/random/anatolian_plateau.js | 5 +---- .../mods/public/maps/random/archipelago.js | 5 +---- .../public/maps/random/ardennes_forest.js | 6 +---- .../public/maps/random/atlas_mountains.js | 6 +---- .../public/maps/random/belgian_uplands.js | 8 ++----- .../maps/random/cantabrian_highlands.js | 6 +---- .../data/mods/public/maps/random/canyon.js | 5 +---- .../data/mods/public/maps/random/continent.js | 5 +---- .../public/maps/random/corinthian_isthmus.js | 4 +--- .../data/mods/public/maps/random/corsica.js | 6 +---- .../maps/random/cycladic_archipelago.js | 6 +---- .../mods/public/maps/random/deep_forest.js | 3 +-- .../public/maps/random/english_channel.js | 6 +---- .../data/mods/public/maps/random/flood.js | 3 +-- .../data/mods/public/maps/random/fortress.js | 12 ++++------ binaries/data/mods/public/maps/random/gear.js | 6 +---- .../public/maps/random/guadalquivir_river.js | 5 +---- .../public/maps/random/gulf_of_bothnia.js | 5 +---- .../public/maps/random/hyrcanian_shores.js | 6 +---- .../public/maps/random/island_stronghold.js | 3 +-- .../data/mods/public/maps/random/islands.js | 5 +---- .../data/mods/public/maps/random/kerala.js | 5 +---- binaries/data/mods/public/maps/random/lake.js | 5 +---- .../data/mods/public/maps/random/latium.js | 6 +---- .../mods/public/maps/random/lorraine_plain.js | 5 +---- .../data/mods/public/maps/random/mainland.js | 5 +---- .../data/mods/public/maps/random/migration.js | 5 +---- .../maps/random/neareastern_badlands.js | 6 +---- .../mods/public/maps/random/new_rms_test.js | 6 +---- .../public/maps/random/northern_lights.js | 5 +---- .../data/mods/public/maps/random/oasis.js | 5 +---- .../public/maps/random/persian_highlands.js | 4 +--- .../public/maps/random/pheonician_levant.js | 4 +--- .../public/maps/random/pyrenean_sierra.js | 5 +---- .../public/maps/random/rhine_marshlands.js | 5 +---- .../data/mods/public/maps/random/rivers.js | 5 +---- .../mods/public/maps/random/rmgen/library.js | 2 ++ .../mods/public/maps/random/rmgen/misc.js | 22 ++++++++++--------- .../public/maps/random/rmgen/wall_builder.js | 6 ++--- .../mods/public/maps/random/saharan_oases.js | 4 +--- .../data/mods/public/maps/random/sahel.js | 6 +---- .../maps/random/sahel_watering_holes.js | 5 +---- .../mods/public/maps/random/schwarzwald.js | 4 +--- .../public/maps/random/snowflake_searocks.js | 6 +---- .../maps/random/survivalofthefittest.js | 7 ++---- .../data/mods/public/maps/random/syria.js | 6 +---- .../data/mods/public/maps/random/the_nile.js | 4 +--- .../data/mods/public/maps/random/unknown.js | 7 ++---- .../mods/public/maps/random/unknown_land.js | 5 +---- .../mods/public/maps/random/unknown_nomad.js | 3 --- .../mods/public/maps/random/volcanic_lands.js | 3 +-- 54 files changed, 72 insertions(+), 222 deletions(-) diff --git a/binaries/data/mods/public/maps/random/aegean_sea.js b/binaries/data/mods/public/maps/random/aegean_sea.js index 89c6d1e1da..b013e43993 100644 --- a/binaries/data/mods/public/maps/random/aegean_sea.js +++ b/binaries/data/mods/public/maps/random/aegean_sea.js @@ -49,8 +49,6 @@ const aDecorativeRock = "actor|geology/stone_granite_med.xml"; // terrain + entity (for painting) const pForest = [tForestFloor, tForestFloor + TERRAIN_SEPARATOR + oCarob, tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - log("Initializing map..."); InitMap(); @@ -135,7 +133,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/alpine_lakes.js b/binaries/data/mods/public/maps/random/alpine_lakes.js index db77428415..998e43fc10 100644 --- a/binaries/data/mods/public/maps/random/alpine_lakes.js +++ b/binaries/data/mods/public/maps/random/alpine_lakes.js @@ -87,9 +87,7 @@ else //other constants const pForest = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor]; -const BUILDING_ANGlE = -PI/4; -// initialize map log("Initializing map..."); InitMap(); @@ -170,7 +168,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/alpine_valley.js b/binaries/data/mods/public/maps/random/alpine_valley.js index 1140ab975b..dc43cda851 100644 --- a/binaries/data/mods/public/maps/random/alpine_valley.js +++ b/binaries/data/mods/public/maps/random/alpine_valley.js @@ -74,9 +74,7 @@ else //other constants const pForest = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor]; -const BUILDING_ANGlE = -PI/4; -// initialize map log("Initializing map..."); InitMap(); @@ -157,7 +155,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/anatolian_plateau.js b/binaries/data/mods/public/maps/random/anatolian_plateau.js index 2400d4d819..4e558464fb 100644 --- a/binaries/data/mods/public/maps/random/anatolian_plateau.js +++ b/binaries/data/mods/public/maps/random/anatolian_plateau.js @@ -33,9 +33,6 @@ const aBushMedium = "actor|props/flora/bush_medit_me.xml"; const aBushSmall = "actor|props/flora/bush_medit_sm.xml"; const pForest = [tForestFloor + TERRAIN_SEPARATOR + oPoplar, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -107,7 +104,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/archipelago.js b/binaries/data/mods/public/maps/random/archipelago.js index 5646f30d77..5864d16ced 100644 --- a/binaries/data/mods/public/maps/random/archipelago.js +++ b/binaries/data/mods/public/maps/random/archipelago.js @@ -49,9 +49,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -127,7 +124,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, [terrainPainter, elevationPainter, paintClass(clPlayer)], null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' }); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/ardennes_forest.js b/binaries/data/mods/public/maps/random/ardennes_forest.js index 2d14cf9506..efb2727470 100644 --- a/binaries/data/mods/public/maps/random/ardennes_forest.js +++ b/binaries/data/mods/public/maps/random/ardennes_forest.js @@ -1,9 +1,5 @@ RMS.LoadLibrary("rmgen"); -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -177,7 +173,7 @@ for (var i=0; i < numPlayers; i++) var iz = round(fz); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); var citySize = 250 diff --git a/binaries/data/mods/public/maps/random/atlas_mountains.js b/binaries/data/mods/public/maps/random/atlas_mountains.js index 260473f877..4fd110a98b 100644 --- a/binaries/data/mods/public/maps/random/atlas_mountains.js +++ b/binaries/data/mods/public/maps/random/atlas_mountains.js @@ -46,10 +46,6 @@ const aAleppoPine = "actor|flora/trees/aleppo_pine.xml"; const pForest1 = [tForestFloor + TERRAIN_SEPARATOR + oCarob, tForestFloor]; const pForest2 = [tForestFloor + TERRAIN_SEPARATOR + oAleppoPine, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -121,7 +117,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/belgian_uplands.js b/binaries/data/mods/public/maps/random/belgian_uplands.js index 4474b0e9ec..053ff647e4 100644 --- a/binaries/data/mods/public/maps/random/belgian_uplands.js +++ b/binaries/data/mods/public/maps/random/belgian_uplands.js @@ -6,10 +6,6 @@ timeArray.push(new Date().getTime()); RMS.LoadLibrary("rmgen"); RMS.LoadLibrary("heightmap"); -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -419,14 +415,14 @@ for (var p = 0; p < numPlayers; p++) { var actualX = possibleStartPositions[bestDerivation[p]][0]; var actualY = possibleStartPositions[bestDerivation[p]][1]; - placeCivDefaultEntities(actualX, actualY, p + 1, BUILDING_ANGlE, {"iberWall" : false}); + placeCivDefaultEntities(actualX, actualY, p + 1, { "iberWall": false }); // Place some start resources var uDist = 8; var uSpace = 1; for (var j = 1; j <= 4; ++j) { - var uAngle = BUILDING_ANGlE - PI * (2-j) / 2; + var uAngle = BUILDING_ORIENTATION - PI * (2-j) / 2; var count = 4; for (var numberofentities = 0; numberofentities < count; numberofentities++) { diff --git a/binaries/data/mods/public/maps/random/cantabrian_highlands.js b/binaries/data/mods/public/maps/random/cantabrian_highlands.js index 3524e10330..7811354a04 100644 --- a/binaries/data/mods/public/maps/random/cantabrian_highlands.js +++ b/binaries/data/mods/public/maps/random/cantabrian_highlands.js @@ -47,10 +47,6 @@ const aBushSmall = "actor|props/flora/bush_medit_sm.xml"; const pForestD = [tGrassDForest + TERRAIN_SEPARATOR + oOak, tGrassDForest + TERRAIN_SEPARATOR + oOakLarge, tGrassDForest]; const pForestP = [tGrassPForest + TERRAIN_SEPARATOR + oPine, tGrassPForest + TERRAIN_SEPARATOR + oAleppoPine, tGrassPForest]; -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -145,7 +141,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : false}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': false }); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/canyon.js b/binaries/data/mods/public/maps/random/canyon.js index 4b5f7f6e70..ef3b3f4cec 100644 --- a/binaries/data/mods/public/maps/random/canyon.js +++ b/binaries/data/mods/public/maps/random/canyon.js @@ -49,9 +49,6 @@ const aTree = rBiomeA9(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -156,7 +153,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, [terrainPainter, elevationPainter, paintClass(clLand)], null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/continent.js b/binaries/data/mods/public/maps/random/continent.js index a7401b381e..1715326d10 100644 --- a/binaries/data/mods/public/maps/random/continent.js +++ b/binaries/data/mods/public/maps/random/continent.js @@ -46,9 +46,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -153,7 +150,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, [elevationPainter, paintClass(clLand)], null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/corinthian_isthmus.js b/binaries/data/mods/public/maps/random/corinthian_isthmus.js index 3edae1eb1b..23a291eca6 100644 --- a/binaries/data/mods/public/maps/random/corinthian_isthmus.js +++ b/binaries/data/mods/public/maps/random/corinthian_isthmus.js @@ -46,8 +46,6 @@ const aDecorativeRock = "actor|geology/stone_granite_med.xml"; // terrain + entity (for painting) const pForest = [tForestFloor, tForestFloor + TERRAIN_SEPARATOR + oCarob, tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - log("Initializing map..."); InitMap(); @@ -182,7 +180,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' }); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/corsica.js b/binaries/data/mods/public/maps/random/corsica.js index e9340772db..20a9437ccb 100644 --- a/binaries/data/mods/public/maps/random/corsica.js +++ b/binaries/data/mods/public/maps/random/corsica.js @@ -61,10 +61,6 @@ var tForestNicae = [tForestFloor + TERRAIN_SEPARATOR + ePine,tForestFloor + TERR var tForestNicaeLight = [tForestFloor + TERRAIN_SEPARATOR + ePine,tForestFloor + TERRAIN_SEPARATOR + ePine,tForestFloor + TERRAIN_SEPARATOR + eFanPalm, tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor]; var tForestNicaeScarce = [tForestFloor + TERRAIN_SEPARATOR + ePine,tForestFloor + TERRAIN_SEPARATOR + ePine,tForestFloor + TERRAIN_SEPARATOR + eFanPalm, tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor]; -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -336,7 +332,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, [painter,paintClass(clSettlement),elevationPainter], null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : false}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': false }); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/cycladic_archipelago.js b/binaries/data/mods/public/maps/random/cycladic_archipelago.js index 06bb0f4862..28f5ebc68a 100644 --- a/binaries/data/mods/public/maps/random/cycladic_archipelago.js +++ b/binaries/data/mods/public/maps/random/cycladic_archipelago.js @@ -70,10 +70,6 @@ const pPineForest = [tForestFloor+TERRAIN_SEPARATOR+oPine, tGrass]; const pPoplarForest = [tForestFloor+TERRAIN_SEPARATOR+oLombardyPoplar, tGrass]; const pMainForest = [tForestFloor+TERRAIN_SEPARATOR+oCarob, tForestFloor+TERRAIN_SEPARATOR+oBeech, tGrass, tGrass]; -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -284,7 +280,7 @@ if((numPlayers>=6)||(i==startingPlaces[numPlayers-1][nPlayer])){ createArea(placer, [painter,paintClass(clCity)], null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' }); nPlayer++; } diff --git a/binaries/data/mods/public/maps/random/deep_forest.js b/binaries/data/mods/public/maps/random/deep_forest.js index ba2b7758ce..bdbcee429b 100644 --- a/binaries/data/mods/public/maps/random/deep_forest.js +++ b/binaries/data/mods/public/maps/random/deep_forest.js @@ -58,7 +58,6 @@ var numPlayers = getNumPlayers(); var baseRadius = 20; var minPlayerRadius = min(mapRadius-1.5*baseRadius, 5*mapRadius/8); var maxPlayerRadius = min(mapRadius-baseRadius, 3*mapRadius/4); -const BUILDING_ANGlE = -PI/4; var playerStartLocX = new Array(numPlayers); var playerStartLocZ = new Array(numPlayers); var playerAngle = new Array(numPlayers); @@ -96,7 +95,7 @@ for (var i=0; i < numPlayers; i++) playerStartLocX[i] = x; playerStartLocZ[i] = z; // Place starting entities - placeCivDefaultEntities(x, z, i+1, BUILDING_ANGlE); + placeCivDefaultEntities(x, z, i+1); // Place base texture var placer = new ClumpPlacer(2*baseRadius*baseRadius, 2/3, 1/8, 10, x, z); var painter = [new LayeredPainter([terrainBaseBorder, terrainBase, terrainBaseCenter], [baseRadius/4, baseRadius/4]), paintClass(clPlayer)]; diff --git a/binaries/data/mods/public/maps/random/english_channel.js b/binaries/data/mods/public/maps/random/english_channel.js index 492558f759..9fc2fdde19 100644 --- a/binaries/data/mods/public/maps/random/english_channel.js +++ b/binaries/data/mods/public/maps/random/english_channel.js @@ -49,10 +49,6 @@ const pForestP = [tGrassPForest + TERRAIN_SEPARATOR + oOak, tGrassPForest]; const WATER_WIDTH = 0.25; -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -144,7 +140,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, [painter, paintClass(clPlayer)], null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/flood.js b/binaries/data/mods/public/maps/random/flood.js index 65027c72d5..41808b71b2 100644 --- a/binaries/data/mods/public/maps/random/flood.js +++ b/binaries/data/mods/public/maps/random/flood.js @@ -47,7 +47,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; log("Initializing map..."); InitMap(); @@ -146,7 +145,7 @@ for (let i = 0; i < numPlayers; ++i) addToClass(ix - 5, iz, clPlayer); addToClass(ix, iz - 5, clPlayer); - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, { "iberWall": false }); + placeCivDefaultEntities(fx, fz, id, { "iberWall": false }); // Create the city patch let cityRadius = radius/3; diff --git a/binaries/data/mods/public/maps/random/fortress.js b/binaries/data/mods/public/maps/random/fortress.js index 602ed95652..c44493b832 100644 --- a/binaries/data/mods/public/maps/random/fortress.js +++ b/binaries/data/mods/public/maps/random/fortress.js @@ -47,10 +47,6 @@ const pForestD = [tForestFloor + TERRAIN_SEPARATOR + oBeech, tForestFloor]; const pForestO = [tForestFloor + TERRAIN_SEPARATOR + oOak, tForestFloor]; const pForestP = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -100,12 +96,12 @@ for (var i=0; i < numPlayers; i++) { var startEntities = getStartingEntities(i); // Place starting entities - createStartingPlayerEntities(playerX[i], playerZ[i], i+1, startEntities, BUILDING_ANGlE) + createStartingPlayerEntities(playerX[i], playerZ[i], i+1, startEntities) var uDist = 8; var uSpace = 2; for (var j = 1; j < startEntities.length - 1; ++j) { - var uAngle = BUILDING_ANGlE - PI * (2-j) / 2; + var uAngle = BUILDING_ORIENTATION - PI * (2-j) / 2; var count = (startEntities[j].Count !== undefined ? startEntities[j].Count : 1); for (var numberofentities = 0; numberofentities < count; numberofentities++) { @@ -115,7 +111,7 @@ for (var i=0; i < numPlayers; i++) } } // create resources - var bbAngle = BUILDING_ANGlE; + var bbAngle = BUILDING_ORIENTATION; var bbDist = 10; var bbX = round(playerX[i] + bbDist * cos(bbAngle)); var bbZ = round(playerZ[i] + bbDist * sin(bbAngle)); @@ -191,7 +187,7 @@ for (var i=0; i < numPlayers; i++) "cornerIn", "wallLong", "house", "tower", "wallLong", "tower", "wallLong", "cornerIn", "wallLong", "house", "tower"]; } - placeCustomFortress(playerX[i], playerZ[i], new Fortress("Spahbod", wall), civ, i+1, BUILDING_ANGlE); + placeCustomFortress(playerX[i], playerZ[i], new Fortress("Spahbod", wall), civ, i+1); } // create lakes diff --git a/binaries/data/mods/public/maps/random/gear.js b/binaries/data/mods/public/maps/random/gear.js index 1b40b0a47a..9f30f30d4a 100644 --- a/binaries/data/mods/public/maps/random/gear.js +++ b/binaries/data/mods/public/maps/random/gear.js @@ -48,10 +48,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - - -// initialize map log("Initializing map..."); @@ -156,7 +152,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' }); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/guadalquivir_river.js b/binaries/data/mods/public/maps/random/guadalquivir_river.js index 3e03826416..ff75ef0e56 100644 --- a/binaries/data/mods/public/maps/random/guadalquivir_river.js +++ b/binaries/data/mods/public/maps/random/guadalquivir_river.js @@ -43,9 +43,6 @@ const aBushSmall = "actor|props/flora/bush_medit_sm.xml"; const pForestP = [tForestFloorP + TERRAIN_SEPARATOR + oPoplar, tForestFloorP]; const pForestC = [tForestFloorC + TERRAIN_SEPARATOR + oCarob, tForestFloorC]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -152,7 +149,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : false}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': false }); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/gulf_of_bothnia.js b/binaries/data/mods/public/maps/random/gulf_of_bothnia.js index 07db7afe6c..47adbbb72c 100644 --- a/binaries/data/mods/public/maps/random/gulf_of_bothnia.js +++ b/binaries/data/mods/public/maps/random/gulf_of_bothnia.js @@ -121,9 +121,6 @@ else } const pForest = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -209,7 +206,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/hyrcanian_shores.js b/binaries/data/mods/public/maps/random/hyrcanian_shores.js index de3e432e6a..8d30653782 100644 --- a/binaries/data/mods/public/maps/random/hyrcanian_shores.js +++ b/binaries/data/mods/public/maps/random/hyrcanian_shores.js @@ -47,10 +47,6 @@ const pForestP = [tGrassPForest + TERRAIN_SEPARATOR + oOak, tGrassPForest]; const WATER_WIDTH = 0.25; -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -128,7 +124,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/island_stronghold.js b/binaries/data/mods/public/maps/random/island_stronghold.js index 630f5154cb..c92d9695c0 100644 --- a/binaries/data/mods/public/maps/random/island_stronghold.js +++ b/binaries/data/mods/public/maps/random/island_stronghold.js @@ -59,7 +59,6 @@ const aRockMedium = rBiomeA6(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; log("Initializing map..."); InitMap(); @@ -166,7 +165,7 @@ for (let i = 0; i < teams.length; ++i) createArea(placer, [terrainPainter, elevationPainter, paintClass(clLand)], null); // create starting units - placeCivDefaultEntities(fx, fz, teams[i][p], BUILDING_ANGlE, { "iberWall": false }); + placeCivDefaultEntities(fx, fz, teams[i][p], { "iberWall": false }); } log("Create initial mines for team " + i); diff --git a/binaries/data/mods/public/maps/random/islands.js b/binaries/data/mods/public/maps/random/islands.js index f29e8b6b55..1b4c6e5da3 100644 --- a/binaries/data/mods/public/maps/random/islands.js +++ b/binaries/data/mods/public/maps/random/islands.js @@ -48,9 +48,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -124,7 +121,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, [terrainPainter, elevationPainter, paintClass(clPlayer)], null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' }); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/kerala.js b/binaries/data/mods/public/maps/random/kerala.js index 3ed276e4e4..eee0a599b8 100644 --- a/binaries/data/mods/public/maps/random/kerala.js +++ b/binaries/data/mods/public/maps/random/kerala.js @@ -34,9 +34,6 @@ const aBush3 = "actor|props/flora/plant_tropic_large.xml"; const pForestD = [tForestFloor + TERRAIN_SEPARATOR + oTree, tForestFloor]; const pForestP = [tForestFloor + TERRAIN_SEPARATOR + oPalm, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -112,7 +109,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/lake.js b/binaries/data/mods/public/maps/random/lake.js index 142d972004..6186c3dedd 100644 --- a/binaries/data/mods/public/maps/random/lake.js +++ b/binaries/data/mods/public/maps/random/lake.js @@ -46,9 +46,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -125,7 +122,7 @@ for (var i = 0; i < numPlayers; i++) addToClass(ix, iz-5, clPlayer); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/latium.js b/binaries/data/mods/public/maps/random/latium.js index c0624239ed..3026702d11 100644 --- a/binaries/data/mods/public/maps/random/latium.js +++ b/binaries/data/mods/public/maps/random/latium.js @@ -63,10 +63,6 @@ const pPineForest = [tForestFloor+TERRAIN_SEPARATOR+oPine, tGrass]; const pPoplarForest = [tForestFloor+TERRAIN_SEPARATOR+oLombardyPoplar, tGrass]; const pMainForest = [tForestFloor+TERRAIN_SEPARATOR+oCarob, tForestFloor+TERRAIN_SEPARATOR+oBeech, tGrass, tGrass]; -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -431,7 +427,7 @@ for (var i = 1; i <= numPlayers; i++) createArea(placer, [painter, elevationPainter], null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/lorraine_plain.js b/binaries/data/mods/public/maps/random/lorraine_plain.js index 5ba788081f..13bcd21acc 100644 --- a/binaries/data/mods/public/maps/random/lorraine_plain.js +++ b/binaries/data/mods/public/maps/random/lorraine_plain.js @@ -42,9 +42,6 @@ const aBushSmall = "actor|props/flora/bush_medit_sm.xml"; const pForestB = [tGrassDForest + TERRAIN_SEPARATOR + oBeech, tGrassDForest]; const pForestO = [tGrassPForest + TERRAIN_SEPARATOR + oOak, tGrassPForest]; const pForestR = [tGrassDForest + TERRAIN_SEPARATOR + oBeech, tGrassDForest, tGrassDForest + TERRAIN_SEPARATOR + oOak, tGrassDForest, tGrassDForest, tGrassDForest]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -133,7 +130,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' }); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/mainland.js b/binaries/data/mods/public/maps/random/mainland.js index 6df7741626..0caee09dd6 100644 --- a/binaries/data/mods/public/maps/random/mainland.js +++ b/binaries/data/mods/public/maps/random/mainland.js @@ -46,9 +46,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -125,7 +122,7 @@ for (var i = 0; i < numPlayers; i++) addToClass(ix, iz-5, clPlayer); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create the city patch var cityRadius = radius/3; diff --git a/binaries/data/mods/public/maps/random/migration.js b/binaries/data/mods/public/maps/random/migration.js index 48117944fa..f7acf37f8d 100644 --- a/binaries/data/mods/public/maps/random/migration.js +++ b/binaries/data/mods/public/maps/random/migration.js @@ -47,9 +47,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -132,7 +129,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : false}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': false }); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/neareastern_badlands.js b/binaries/data/mods/public/maps/random/neareastern_badlands.js index 316a574f47..e6aa86f0b2 100644 --- a/binaries/data/mods/public/maps/random/neareastern_badlands.js +++ b/binaries/data/mods/public/maps/random/neareastern_badlands.js @@ -43,10 +43,6 @@ const aDecorativeRock = "actor|geology/stone_desert_med.xml"; const pForest = [tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor]; const pForestOasis = [tGrass + TERRAIN_SEPARATOR + oDatePalm, tGrass + TERRAIN_SEPARATOR + oSDatePalm, tGrass]; -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -119,7 +115,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/new_rms_test.js b/binaries/data/mods/public/maps/random/new_rms_test.js index d5dd253be5..53ebc0f8c2 100644 --- a/binaries/data/mods/public/maps/random/new_rms_test.js +++ b/binaries/data/mods/public/maps/random/new_rms_test.js @@ -1,9 +1,5 @@ RMS.LoadLibrary("rmgen"); -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -56,7 +52,7 @@ for (var i=0; i < numPlayers; i++) var iz = round(fz); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); } diff --git a/binaries/data/mods/public/maps/random/northern_lights.js b/binaries/data/mods/public/maps/random/northern_lights.js index 065fb10561..b89d720ed9 100644 --- a/binaries/data/mods/public/maps/random/northern_lights.js +++ b/binaries/data/mods/public/maps/random/northern_lights.js @@ -29,9 +29,6 @@ const aIceberg = "actor|props/special/eyecandy/iceberg.xml"; const pForestD = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor, tForestFloor]; const pForestS = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor, tForestFloor, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -107,7 +104,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create metal mine var bbAngle = randFloat(0, TWO_PI); diff --git a/binaries/data/mods/public/maps/random/oasis.js b/binaries/data/mods/public/maps/random/oasis.js index 0c1f17337d..b0df255681 100644 --- a/binaries/data/mods/public/maps/random/oasis.js +++ b/binaries/data/mods/public/maps/random/oasis.js @@ -39,9 +39,6 @@ const aSand = "actor|particle/blowing_sand.xml"; const pForestMain = [tForestFloor + TERRAIN_SEPARATOR + ePalmShort, tForestFloor + TERRAIN_SEPARATOR + ePalmTall, tForestFloor]; const pOasisForestLight = [tForestFloor + TERRAIN_SEPARATOR + ePalmShort, tForestFloor + TERRAIN_SEPARATOR + ePalmTall, tForestFloor,tForestFloor,tForestFloor ,tForestFloor,tForestFloor,tForestFloor,tForestFloor]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -126,7 +123,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/persian_highlands.js b/binaries/data/mods/public/maps/random/persian_highlands.js index c829b0151f..211cff4fe7 100644 --- a/binaries/data/mods/public/maps/random/persian_highlands.js +++ b/binaries/data/mods/public/maps/random/persian_highlands.js @@ -54,8 +54,6 @@ const aDecorativeRock = "actor|geology/stone_desert_med.xml"; // terrain + entity (for painting) const pForestO = [tForestFloor + TERRAIN_SEPARATOR + oOak, tForestFloor + TERRAIN_SEPARATOR + oOak, tForestFloor, tDirtMain, tDirtMain]; -const BUILDING_ANGlE = -PI/4; - log("Initializing map..."); InitMap(); @@ -136,7 +134,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/pheonician_levant.js b/binaries/data/mods/public/maps/random/pheonician_levant.js index 9af7665673..046e981059 100644 --- a/binaries/data/mods/public/maps/random/pheonician_levant.js +++ b/binaries/data/mods/public/maps/random/pheonician_levant.js @@ -44,8 +44,6 @@ const aDecorativeRock = "actor|geology/stone_granite_med.xml"; // terrain + entity (for painting) const pForest = [tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor + TERRAIN_SEPARATOR + oCarob, tForestFloor, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - log("Initializing map..."); InitMap(); @@ -118,7 +116,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/pyrenean_sierra.js b/binaries/data/mods/public/maps/random/pyrenean_sierra.js index 282991feaf..5591601a1b 100644 --- a/binaries/data/mods/public/maps/random/pyrenean_sierra.js +++ b/binaries/data/mods/public/maps/random/pyrenean_sierra.js @@ -242,9 +242,6 @@ const pForestLandVeryLight = [ tGrassLandForest2 + TERRAIN_SEPARATOR + oPine,tGr tForestTransition,tGrassLandForest2,tForestTransition,tForestTransition,tForestTransition, tGrassLandForest,tForestTransition,tGrassLandForest2,tForestTransition, tGrassLandForest2,tGrassLandForest2,tGrassLandForest2,tGrassLandForest2]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -351,7 +348,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/rhine_marshlands.js b/binaries/data/mods/public/maps/random/rhine_marshlands.js index e300e02620..ef5e735b60 100644 --- a/binaries/data/mods/public/maps/random/rhine_marshlands.js +++ b/binaries/data/mods/public/maps/random/rhine_marshlands.js @@ -37,9 +37,6 @@ const aBushSmall = "actor|props/flora/bush_medit_sm.xml"; const pForestD = [tForestFloor + TERRAIN_SEPARATOR + oBeech, tForestFloor]; const pForestP = [tForestFloor + TERRAIN_SEPARATOR + oOak, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -113,7 +110,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/rivers.js b/binaries/data/mods/public/maps/random/rivers.js index a5a8293b7c..7b72f051b1 100644 --- a/binaries/data/mods/public/maps/random/rivers.js +++ b/binaries/data/mods/public/maps/random/rivers.js @@ -50,9 +50,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -154,7 +151,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/rmgen/library.js b/binaries/data/mods/public/maps/random/rmgen/library.js index 5792dbe00d..30fbff4dd2 100644 --- a/binaries/data/mods/public/maps/random/rmgen/library.js +++ b/binaries/data/mods/public/maps/random/rmgen/library.js @@ -13,6 +13,8 @@ const FALLBACK_CIV = "athen"; 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; +// Default angle for buildings +const BUILDING_ORIENTATION = - PI / 4; function fractionToTiles(f) { diff --git a/binaries/data/mods/public/maps/random/rmgen/misc.js b/binaries/data/mods/public/maps/random/rmgen/misc.js index c4cc8f0623..c4a4d02f19 100644 --- a/binaries/data/mods/public/maps/random/rmgen/misc.js +++ b/binaries/data/mods/public/maps/random/rmgen/misc.js @@ -136,17 +136,17 @@ function rndRiver(f, seed) // fx&fz: position of player base // playerid: id of player // civEntities: use getStartingEntities(id-1) fo this one -// BUILDING_ANGlE: angle of main base building +// orientation: orientation of the main base building, default is BUILDING_ORIENTATION // /////////////////////////////////////////////////////////////////////////////////////////// -function createStartingPlayerEntities(fx, fz, playerid, civEntities, BUILDING_ANGlE) +function createStartingPlayerEntities(fx, fz, playerid, civEntities, orientation = BUILDING_ORIENTATION) { var uDist = 6; var uSpace = 2; - placeObject(fx, fz, civEntities[0].Template, playerid, BUILDING_ANGlE); + placeObject(fx, fz, civEntities[0].Template, playerid, orientation); for (var j = 1; j < civEntities.length; ++j) { - var uAngle = BUILDING_ANGlE - PI * (2-j) / 2; + var uAngle = orientation - PI * (2-j) / 2; var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1); for (var numberofentities = 0; numberofentities < count; numberofentities++) { @@ -163,29 +163,31 @@ function createStartingPlayerEntities(fx, fz, playerid, civEntities, BUILDING_AN // 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 +// 'orientation': angle of the main base building, default is BUILDING_ORIENTATION // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function placeCivDefaultEntities(fx, fz, playerid, angle, kwargs) +function placeCivDefaultEntities(fx, fz, playerid, kwargs = {}) { // Unpack kwargs - kwargs = (kwargs || {}); var iberWall = 'walls'; if (getMapSize() <= 128) iberWall = false; if ('iberWall' in kwargs) iberWall = kwargs['iberWall']; + var orientation = BUILDING_ORIENTATION + if ('orientation' in kwargs) + orientation = kwargs['orientation']; // Place default civ starting entities var civ = getCivCode(playerid-1); var civEntities = getStartingEntities(playerid-1); var uDist = 6; var uSpace = 2; - placeObject(fx, fz, civEntities[0].Template, playerid, angle); + placeObject(fx, fz, civEntities[0].Template, playerid, orientation); for (var j = 1; j < civEntities.length; ++j) { - var uAngle = angle - PI * (2-j) / 2; + var uAngle = orientation - PI * (2-j) / 2; var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1); for (var numberofentities = 0; numberofentities < count; numberofentities++) { @@ -198,7 +200,7 @@ function placeCivDefaultEntities(fx, fz, playerid, angle, kwargs) if (civ == 'iber' && iberWall != false) { if (iberWall == 'towers') - placePolygonalWall(fx, fz, 15, ['entry'], 'tower', civ, playerid, angle, 7); + placePolygonalWall(fx, fz, 15, ['entry'], 'tower', civ, playerid, orientation, 7); else placeGenericFortress(fx, fz, 20/*radius*/, playerid); } diff --git a/binaries/data/mods/public/maps/random/rmgen/wall_builder.js b/binaries/data/mods/public/maps/random/rmgen/wall_builder.js index bde9b79355..3b67639fc7 100644 --- a/binaries/data/mods/public/maps/random/rmgen/wall_builder.js +++ b/binaries/data/mods/public/maps/random/rmgen/wall_builder.js @@ -470,13 +470,12 @@ function placeWall(startX, startY, wall, style, playerId, orientation) // fortress An instance of Fortress with a wall defined // 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 (should be a gate or entrance) is placed. Default is 0 +// orientation Optional. Angle the first wall element (should be a gate or entrance) is placed. Default is BUILDING_ORIENTATION ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function placeCustomFortress(centerX, centerY, fortress, style, playerId, orientation) +function placeCustomFortress(centerX, centerY, fortress, style, playerId = 0, orientation = BUILDING_ORIENTATION) { // Graciously handle arguments fortress = (fortress || fortressTypes["medium"]); - playerId = (playerId || 0); if (!wallStyles.hasOwnProperty(style)) { if (playerId == 0) @@ -484,7 +483,6 @@ function placeCustomFortress(centerX, centerY, fortress, style, playerId, orient else style = (getCivCode(playerId-1)); } - orientation = (orientation || 0); // Calculate center if fortress.centerToFirstElement is undefined (default) var centerToFirstElement = fortress.centerToFirstElement; diff --git a/binaries/data/mods/public/maps/random/saharan_oases.js b/binaries/data/mods/public/maps/random/saharan_oases.js index d7b22138d3..7689332f76 100644 --- a/binaries/data/mods/public/maps/random/saharan_oases.js +++ b/binaries/data/mods/public/maps/random/saharan_oases.js @@ -47,8 +47,6 @@ const aLillies = "actor|props/flora/water_lillies.xml"; // terrain + entity (for painting) const pForest = [tLush + TERRAIN_SEPARATOR + oDatePalm, tLush + TERRAIN_SEPARATOR + oSDatePalm, tLush]; -const BUILDING_ANGlE = -PI/4; - log("Initializing map..."); InitMap(); @@ -118,7 +116,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/sahel.js b/binaries/data/mods/public/maps/random/sahel.js index e23e2b7dab..ce7ef9cf2b 100644 --- a/binaries/data/mods/public/maps/random/sahel.js +++ b/binaries/data/mods/public/maps/random/sahel.js @@ -52,10 +52,6 @@ function placeStoneMineFormation(x, z) } } -const BUILDING_ANGlE = -PI/4; - -// initialize map - log("Initializing map..."); InitMap(); @@ -121,7 +117,7 @@ for (var i = 0; i < numPlayers; i++) addToClass(ix, iz-5, clPlayer); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/sahel_watering_holes.js b/binaries/data/mods/public/maps/random/sahel_watering_holes.js index c6aa26108e..bfa4a43afe 100644 --- a/binaries/data/mods/public/maps/random/sahel_watering_holes.js +++ b/binaries/data/mods/public/maps/random/sahel_watering_holes.js @@ -40,9 +40,6 @@ const aBushMedium = "actor|props/flora/bush_desert_dry_a.xml"; const aBushSmall = "actor|props/flora/bush_dry_a.xml"; const pForest = [tForestFloor + TERRAIN_SEPARATOR + oBaobab, tForestFloor + TERRAIN_SEPARATOR + oBaobab, tForestFloor]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -116,7 +113,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/schwarzwald.js b/binaries/data/mods/public/maps/random/schwarzwald.js index ad79accb97..5d11dc540e 100644 --- a/binaries/data/mods/public/maps/random/schwarzwald.js +++ b/binaries/data/mods/public/maps/random/schwarzwald.js @@ -109,8 +109,6 @@ var terrainHillBorder = ['temp_highlands', 'temp_highlands', 'temp_highlands', ' var tWater = ['dirt_brown_d']; var tWaterBorder = ['dirt_brown_d']; -const BUILDING_ANGlE = -PI/4; - // Setup map var mapSize = getMapSize(); var mapRadius = mapSize/2; @@ -242,7 +240,7 @@ for (var i=0; i < numPlayers; i++) rectangularSmoothToHeight([x,z] , 20, 20, playerHeight, 0.8); - placeCivDefaultEntities(x, z, i+1, BUILDING_ANGlE, {'iberWall': false}); + placeCivDefaultEntities(x, z, i+1, { 'iberWall': false }); // Place base texture var placer = new ClumpPlacer(2*baseRadius*baseRadius, 2/3, 1/8, 10, x, z); diff --git a/binaries/data/mods/public/maps/random/snowflake_searocks.js b/binaries/data/mods/public/maps/random/snowflake_searocks.js index be86559f24..90d32593ce 100644 --- a/binaries/data/mods/public/maps/random/snowflake_searocks.js +++ b/binaries/data/mods/public/maps/random/snowflake_searocks.js @@ -46,10 +46,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - - -// initialize map log("Initializing map..."); @@ -1555,7 +1551,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' }); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/survivalofthefittest.js b/binaries/data/mods/public/maps/random/survivalofthefittest.js index d7da0a96ee..937d8955f5 100644 --- a/binaries/data/mods/public/maps/random/survivalofthefittest.js +++ b/binaries/data/mods/public/maps/random/survivalofthefittest.js @@ -49,9 +49,6 @@ const aTree = rBiomeA9(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -163,8 +160,8 @@ for (var i = 0; i < numPlayers; i++) // Place default civ starting entities var uDist = 6; var uSpace = 2; - placeObject(fx, fz, "skirmish/structures/default_civil_centre", id, BUILDING_ANGlE); - var uAngle = BUILDING_ANGlE - PI / 2; + placeObject(fx, fz, "skirmish/structures/default_civil_centre", id, BUILDING_ORIENTATION); + var uAngle = BUILDING_ORIENTATION - PI / 2; var count = 4; for (var numberofentities = 0; numberofentities < count; numberofentities++) { diff --git a/binaries/data/mods/public/maps/random/syria.js b/binaries/data/mods/public/maps/random/syria.js index 6b8c6b5406..de30c5d973 100644 --- a/binaries/data/mods/public/maps/random/syria.js +++ b/binaries/data/mods/public/maps/random/syria.js @@ -40,10 +40,6 @@ const aSand = "actor|particle/blowing_sand.xml"; const pForestP = [tForestFloor2 + TERRAIN_SEPARATOR + oPalm, tForestFloor2]; const pForestT = [tForestFloor1 + TERRAIN_SEPARATOR + oTamarix,tForestFloor2]; -const BUILDING_ANGlE = -PI/4; - - -// initialize map log("Initializing map..."); @@ -122,7 +118,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/the_nile.js b/binaries/data/mods/public/maps/random/the_nile.js index 59f0c498ba..45242bb4bc 100644 --- a/binaries/data/mods/public/maps/random/the_nile.js +++ b/binaries/data/mods/public/maps/random/the_nile.js @@ -49,8 +49,6 @@ var aLillies = "actor|props/flora/water_lillies.xml"; var pForest = [tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor]; var pForestOasis = [tGrass + TERRAIN_SEPARATOR + oDatePalm, tGrass + TERRAIN_SEPARATOR + oSDatePalm, tGrass]; -const BUILDING_ANGlE = -PI/4; - log("Initializing map..."); InitMap(); @@ -144,7 +142,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/unknown.js b/binaries/data/mods/public/maps/random/unknown.js index dda1ff6c93..3d2ead6f3d 100644 --- a/binaries/data/mods/public/maps/random/unknown.js +++ b/binaries/data/mods/public/maps/random/unknown.js @@ -48,9 +48,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -1668,9 +1665,9 @@ for (var i = 0; i < numPlayers; i++) // create starting units if (iberianTowers) - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'}); + placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' }); else - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/unknown_land.js b/binaries/data/mods/public/maps/random/unknown_land.js index 9c4ce84c48..21064d26d4 100644 --- a/binaries/data/mods/public/maps/random/unknown_land.js +++ b/binaries/data/mods/public/maps/random/unknown_land.js @@ -48,9 +48,6 @@ const aBushSmall = rBiomeA8(); const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2]; const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); @@ -1440,7 +1437,7 @@ for (var i = 0; i < numPlayers; i++) var iz = round(fz); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create animals for (var j = 0; j < 2; ++j) diff --git a/binaries/data/mods/public/maps/random/unknown_nomad.js b/binaries/data/mods/public/maps/random/unknown_nomad.js index 0b5edbdea5..db7cc74f74 100644 --- a/binaries/data/mods/public/maps/random/unknown_nomad.js +++ b/binaries/data/mods/public/maps/random/unknown_nomad.js @@ -48,9 +48,6 @@ var aBushSmall = rBiomeA8(); var pForestD = [tGrassDForest + TERRAIN_SEPARATOR + oOak, tGrassDForest + TERRAIN_SEPARATOR + oOakLarge, tGrassDForest]; var pForestP = [tGrassPForest + TERRAIN_SEPARATOR + oPine, tGrassPForest + TERRAIN_SEPARATOR + oAleppoPine, tGrassPForest]; -const BUILDING_ANGlE = -PI/4; - -// initialize map log("Initializing map..."); diff --git a/binaries/data/mods/public/maps/random/volcanic_lands.js b/binaries/data/mods/public/maps/random/volcanic_lands.js index 1ba9157d6d..1fda552a5c 100644 --- a/binaries/data/mods/public/maps/random/volcanic_lands.js +++ b/binaries/data/mods/public/maps/random/volcanic_lands.js @@ -24,7 +24,6 @@ var aSmoke = "actor|particle/smoke.xml"; var pForestD = [tGrassC + TERRAIN_SEPARATOR + oTree, tGrassC]; var pForestP = [tGrassB + TERRAIN_SEPARATOR + oTree, tGrassB]; -const BUILDING_ANGlE = -PI/4; log("Initializing map..."); InitMap(); @@ -90,7 +89,7 @@ for (var i = 0; i < numPlayers; i++) createArea(placer, painter, null); // create starting units - placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE); + placeCivDefaultEntities(fx, fz, id); // create metal mine var bbAngle = randFloat(0, TWO_PI);