diff --git a/binaries/data/mods/public/maps/random/african_plains.js b/binaries/data/mods/public/maps/random/african_plains.js index 0f89f6aee6..4c2a10bc5e 100644 --- a/binaries/data/mods/public/maps/random/african_plains.js +++ b/binaries/data/mods/public/maps/random/african_plains.js @@ -44,7 +44,7 @@ var heightCliff = 3; var g_Map = new RandomMap(heightLand, tPrimary); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); var clPlayer = createTileClass(); var clHill = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/alpine_lakes.js b/binaries/data/mods/public/maps/random/alpine_lakes.js index 2235e8873b..12a17e2eb8 100644 --- a/binaries/data/mods/public/maps/random/alpine_lakes.js +++ b/binaries/data/mods/public/maps/random/alpine_lakes.js @@ -86,7 +86,7 @@ var heightLand = 3; var g_Map = new RandomMap(heightLand, tPrimary); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); var clPlayer = createTileClass(); var clHill = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/ardennes_forest.js b/binaries/data/mods/public/maps/random/ardennes_forest.js index d963abdf71..74e1138d36 100644 --- a/binaries/data/mods/public/maps/random/ardennes_forest.js +++ b/binaries/data/mods/public/maps/random/ardennes_forest.js @@ -56,7 +56,7 @@ const heightOffsetRavine = 10; var g_Map = new RandomMap(heightHill, tPrimary); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/belgian_uplands.js b/binaries/data/mods/public/maps/random/belgian_uplands.js index 25aa7ea709..10ba1f26f6 100644 --- a/binaries/data/mods/public/maps/random/belgian_uplands.js +++ b/binaries/data/mods/public/maps/random/belgian_uplands.js @@ -9,7 +9,7 @@ const heightLand = 0; var g_Map = new RandomMap(heightLand, tPrimary); var numPlayers = getNumPlayers(); -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); var mapCenter = g_Map.getCenter(); // Function to apply a heightmap diff --git a/binaries/data/mods/public/maps/random/cantabrian_highlands.js b/binaries/data/mods/public/maps/random/cantabrian_highlands.js index 2d9812dbca..74b1919c3d 100644 --- a/binaries/data/mods/public/maps/random/cantabrian_highlands.js +++ b/binaries/data/mods/public/maps/random/cantabrian_highlands.js @@ -49,7 +49,7 @@ const heightHill = 20; var g_Map = new RandomMap(heightLand, tPrimary); var numPlayers = getNumPlayers(); -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); var clPlayer = createTileClass(); var clHill = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/canyon.js b/binaries/data/mods/public/maps/random/canyon.js index 343b4c24aa..6c2b7493e0 100644 --- a/binaries/data/mods/public/maps/random/canyon.js +++ b/binaries/data/mods/public/maps/random/canyon.js @@ -46,7 +46,7 @@ const heightHill = 30; var g_Map = new RandomMap(heightHill, tMainTerrain); var numPlayers = getNumPlayers(); -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); var mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/continent.js b/binaries/data/mods/public/maps/random/continent.js index 35b7bf9708..4bc2cc6a63 100644 --- a/binaries/data/mods/public/maps/random/continent.js +++ b/binaries/data/mods/public/maps/random/continent.js @@ -46,7 +46,7 @@ const heightLand = 3; var g_Map = new RandomMap(heightSeaGround, tWater); var numPlayers = getNumPlayers(); -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); var mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/corinthian_isthmus.js b/binaries/data/mods/public/maps/random/corinthian_isthmus.js index b34daff9d1..70303f743b 100644 --- a/binaries/data/mods/public/maps/random/corinthian_isthmus.js +++ b/binaries/data/mods/public/maps/random/corinthian_isthmus.js @@ -47,7 +47,7 @@ var heightLand = 3; var g_Map = new RandomMap(heightLand, tHill); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/corsica.js b/binaries/data/mods/public/maps/random/corsica.js index 71d699405e..b359340f07 100644 --- a/binaries/data/mods/public/maps/random/corsica.js +++ b/binaries/data/mods/public/maps/random/corsica.js @@ -52,7 +52,7 @@ var heightOffsetAntiBumps = -5; var g_Map = new RandomMap(heightSeaGround, tVeryDeepWater); var numPlayers = getNumPlayers(); -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); var mapCenter = g_Map.getCenter(); var clIsland = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/cycladic_archipelago.js b/binaries/data/mods/public/maps/random/cycladic_archipelago.js index 8b8af5b464..a5402378ba 100644 --- a/binaries/data/mods/public/maps/random/cycladic_archipelago.js +++ b/binaries/data/mods/public/maps/random/cycladic_archipelago.js @@ -50,7 +50,7 @@ const heightOffsetBump = 2; var g_Map = new RandomMap(heightSeaGround, tWater); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clCoral = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/danubius.js b/binaries/data/mods/public/maps/random/danubius.js index 28f25919cf..fc4cea7bcd 100644 --- a/binaries/data/mods/public/maps/random/danubius.js +++ b/binaries/data/mods/public/maps/random/danubius.js @@ -128,7 +128,7 @@ const heightIsland = 6; var g_Map = new RandomMap(heightLand, tPrimary); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); const mapBounds = g_Map.getBounds(); diff --git a/binaries/data/mods/public/maps/random/deep_forest.js b/binaries/data/mods/public/maps/random/deep_forest.js index 20995deb44..1ea5cc10e8 100644 --- a/binaries/data/mods/public/maps/random/deep_forest.js +++ b/binaries/data/mods/public/maps/random/deep_forest.js @@ -29,7 +29,7 @@ var heightOffsetRandomPath = 1; var g_Map = new RandomMap(heightLand, terrainPrimary); -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); var mapRadius = mapSize/2; var mapCenter = g_Map.getCenter(); diff --git a/binaries/data/mods/public/maps/random/flood.js b/binaries/data/mods/public/maps/random/flood.js index 5c872ae267..74138dda27 100644 --- a/binaries/data/mods/public/maps/random/flood.js +++ b/binaries/data/mods/public/maps/random/flood.js @@ -63,7 +63,7 @@ const clFood = createTileClass(); const clBaseResource = createTileClass(); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); log("Creating player islands...") diff --git a/binaries/data/mods/public/maps/random/fortress.js b/binaries/data/mods/public/maps/random/fortress.js index afed0a6399..e64b922c20 100644 --- a/binaries/data/mods/public/maps/random/fortress.js +++ b/binaries/data/mods/public/maps/random/fortress.js @@ -46,7 +46,7 @@ var heightLand = 3; var g_Map = new RandomMap(heightLand, tGrass); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); var clPlayer = createTileClass(); var clHill = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/gear.js b/binaries/data/mods/public/maps/random/gear.js index 1becb5be54..20c51f1629 100644 --- a/binaries/data/mods/public/maps/random/gear.js +++ b/binaries/data/mods/public/maps/random/gear.js @@ -51,7 +51,7 @@ var heightHill = 20; var g_Map = new RandomMap(heightLand, tMainTerrain); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/guadalquivir_river.js b/binaries/data/mods/public/maps/random/guadalquivir_river.js index 5eceb27a70..6e3f9da90b 100644 --- a/binaries/data/mods/public/maps/random/guadalquivir_river.js +++ b/binaries/data/mods/public/maps/random/guadalquivir_river.js @@ -43,7 +43,7 @@ var heightLand = 3; var g_Map = new RandomMap(heightSeaGround, tWater); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); const mapBounds = g_Map.getBounds(); 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 a4a163ab9a..82e0dabf81 100644 --- a/binaries/data/mods/public/maps/random/gulf_of_bothnia.js +++ b/binaries/data/mods/public/maps/random/gulf_of_bothnia.js @@ -139,7 +139,7 @@ const pForest = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor]; var g_Map = new RandomMap(heightLand, tPrimary); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/harbor.js b/binaries/data/mods/public/maps/random/harbor.js index 63fdaa0361..d47382b3f2 100644 --- a/binaries/data/mods/public/maps/random/harbor.js +++ b/binaries/data/mods/public/maps/random/harbor.js @@ -20,7 +20,7 @@ createArea( Engine.SetProgress(10); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); const startAngle = randomAngle(); diff --git a/binaries/data/mods/public/maps/random/hells_pass.js b/binaries/data/mods/public/maps/random/hells_pass.js index 89d001241f..45e23050c0 100644 --- a/binaries/data/mods/public/maps/random/hells_pass.js +++ b/binaries/data/mods/public/maps/random/hells_pass.js @@ -268,7 +268,7 @@ function placeBarriers() var mOffset = 0.5; var mTaper = -1.5; - if (spineCount > 3 || getMapSize() <= 192) + if (spineCount > 3 || g_Map.getSize() <= 192) { mWaviness = 0.2; mOffset = 0.2; diff --git a/binaries/data/mods/public/maps/random/india.js b/binaries/data/mods/public/maps/random/india.js index d38430027f..2f3c3a80b2 100644 --- a/binaries/data/mods/public/maps/random/india.js +++ b/binaries/data/mods/public/maps/random/india.js @@ -30,7 +30,7 @@ const heightOffsetBump = 2; var g_Map = new RandomMap(heightLand, tGrass1); var numPlayers = getNumPlayers(); -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); var mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/island_stronghold.js b/binaries/data/mods/public/maps/random/island_stronghold.js index e831d0db6b..7633a364b5 100644 --- a/binaries/data/mods/public/maps/random/island_stronghold.js +++ b/binaries/data/mods/public/maps/random/island_stronghold.js @@ -52,7 +52,7 @@ const heightHill = 18; var g_Map = new RandomMap(heightSeaGround, tWater); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); const clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/islands.js b/binaries/data/mods/public/maps/random/islands.js index 5bb3f5d497..aa2af584e6 100644 --- a/binaries/data/mods/public/maps/random/islands.js +++ b/binaries/data/mods/public/maps/random/islands.js @@ -52,7 +52,7 @@ const heightHill = 18; var g_Map = new RandomMap(heightSeaGround, tWater); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/lake.js b/binaries/data/mods/public/maps/random/lake.js index b02f493eae..591bc4d0d7 100644 --- a/binaries/data/mods/public/maps/random/lake.js +++ b/binaries/data/mods/public/maps/random/lake.js @@ -46,7 +46,7 @@ const heightLand = 3; var g_Map = new RandomMap(heightLand, tMainTerrain); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/latium.js b/binaries/data/mods/public/maps/random/latium.js index e128c5b95a..f17fceb3f5 100644 --- a/binaries/data/mods/public/maps/random/latium.js +++ b/binaries/data/mods/public/maps/random/latium.js @@ -57,7 +57,7 @@ const heightHill = 12; var g_Map = new RandomMap(heightLand, tGrass); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); const mapBounds = g_Map.getBounds(); diff --git a/binaries/data/mods/public/maps/random/lorraine_plain.js b/binaries/data/mods/public/maps/random/lorraine_plain.js index 0092a8d30c..510c36302d 100644 --- a/binaries/data/mods/public/maps/random/lorraine_plain.js +++ b/binaries/data/mods/public/maps/random/lorraine_plain.js @@ -44,7 +44,7 @@ const heightOffsetBump = 2; var g_Map = new RandomMap(heightLand, tPrimary); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); const mapBounds = g_Map.getBounds(); diff --git a/binaries/data/mods/public/maps/random/migration.js b/binaries/data/mods/public/maps/random/migration.js index 7a7e25baf1..53b0064443 100644 --- a/binaries/data/mods/public/maps/random/migration.js +++ b/binaries/data/mods/public/maps/random/migration.js @@ -50,7 +50,7 @@ const heightOffsetBump = 2; var g_Map = new RandomMap(heightSeaGround, tWater); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/neareastern_badlands.js b/binaries/data/mods/public/maps/random/neareastern_badlands.js index cc1490c7dc..a602474052 100644 --- a/binaries/data/mods/public/maps/random/neareastern_badlands.js +++ b/binaries/data/mods/public/maps/random/neareastern_badlands.js @@ -48,7 +48,7 @@ const heightOffsetBump = 2; var g_Map = new RandomMap(heightLand, tPrimary); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/northern_lights.js b/binaries/data/mods/public/maps/random/northern_lights.js index 9b58b15397..d44006759a 100644 --- a/binaries/data/mods/public/maps/random/northern_lights.js +++ b/binaries/data/mods/public/maps/random/northern_lights.js @@ -34,7 +34,7 @@ const heightHill = 25; var g_Map = new RandomMap(heightLand, tSnowA); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); const mapBounds = g_Map.getBounds(); diff --git a/binaries/data/mods/public/maps/random/oasis.js b/binaries/data/mods/public/maps/random/oasis.js index caa623ae6b..0467cae2ce 100644 --- a/binaries/data/mods/public/maps/random/oasis.js +++ b/binaries/data/mods/public/maps/random/oasis.js @@ -45,7 +45,7 @@ const heightOffsetDune = 18; var g_Map = new RandomMap(heightLand, tSand); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/persian_highlands.js b/binaries/data/mods/public/maps/random/persian_highlands.js index 12f8c997cf..c83d3aa8ec 100644 --- a/binaries/data/mods/public/maps/random/persian_highlands.js +++ b/binaries/data/mods/public/maps/random/persian_highlands.js @@ -53,7 +53,7 @@ const heightOffsetValley = -10; var g_Map = new RandomMap(heightLand, tDirtMain); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/phoenician_levant.js b/binaries/data/mods/public/maps/random/phoenician_levant.js index 40040b4c5b..3a042a0641 100644 --- a/binaries/data/mods/public/maps/random/phoenician_levant.js +++ b/binaries/data/mods/public/maps/random/phoenician_levant.js @@ -49,7 +49,7 @@ const heightOffsetBump = 2; var g_Map = new RandomMap(heightLand, tHill); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); const mapBounds = g_Map.getBounds(); diff --git a/binaries/data/mods/public/maps/random/polar_sea.js b/binaries/data/mods/public/maps/random/polar_sea.js index c1b52019d4..e261e2e7e5 100644 --- a/binaries/data/mods/public/maps/random/polar_sea.js +++ b/binaries/data/mods/public/maps/random/polar_sea.js @@ -34,7 +34,7 @@ var heightCliff = 3; var g_Map = new RandomMap(heightLand, tPrimary); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/pyrenean_sierra.js b/binaries/data/mods/public/maps/random/pyrenean_sierra.js index 12539c4115..2a04affe78 100644 --- a/binaries/data/mods/public/maps/random/pyrenean_sierra.js +++ b/binaries/data/mods/public/maps/random/pyrenean_sierra.js @@ -71,7 +71,7 @@ const heightOffsetHillRandom = 2; var g_Map = new RandomMap(heightInit, tGrass); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clDirt = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/rivers.js b/binaries/data/mods/public/maps/random/rivers.js index afc5ee431d..ed0345c244 100644 --- a/binaries/data/mods/public/maps/random/rivers.js +++ b/binaries/data/mods/public/maps/random/rivers.js @@ -53,7 +53,7 @@ const heightLand = 1; var g_Map = new RandomMap(heightLand, tMainTerrain); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/rmgen/gaia_terrain.js b/binaries/data/mods/public/maps/random/rmgen/gaia_terrain.js index cc610b9d04..40cbf8e23d 100644 --- a/binaries/data/mods/public/maps/random/rmgen/gaia_terrain.js +++ b/binaries/data/mods/public/maps/random/rmgen/gaia_terrain.js @@ -46,7 +46,7 @@ function createHills(terrainset, constraint, tileClass, count, minSize, maxSize, function createMountains(terrain, constraint, tileClass, count, maxHeight, minRadius, maxRadius, numCircles) { log("Creating mountains..."); - let mapSize = getMapSize(); + let mapSize = g_Map.getSize(); for (let i = 0; i < (count || scaleByMapSize(1, 4) * getNumPlayers()); ++i) createMountain( @@ -73,7 +73,7 @@ function createMountain(maxHeight, minRadius, maxRadius, numCircles, constraints if (!g_Map.inMapBounds(position) || !constraint.allows(position)) return; - let mapSize = getMapSize(); + let mapSize = g_Map.getSize(); let queueEmpty = !q.length; let gotRet = []; @@ -361,7 +361,7 @@ function paintRiver(args) let riverMaxX = Math.max(args.start.x, args.end.x); let riverMaxZ = Math.max(args.start.y, args.end.y); - let mapSize = getMapSize(); + let mapSize = g_Map.getSize(); for (let ix = 0; ix < mapSize; ++ix) for (let iz = 0; iz < mapSize; ++iz) { @@ -458,7 +458,7 @@ function createTributaryRivers(riverAngle, riverCount, riverWidth, heightRiverbe let tapering = 0.05; let heightShallow = -2; - let mapSize = getMapSize(); + let mapSize = g_Map.getSize(); let mapCenter = g_Map.getCenter(); let mapBounds = g_Map.getBounds(); @@ -534,7 +534,7 @@ function createTributaryRivers(riverAngle, riverCount, riverWidth, heightRiverbe */ function createPassage(args) { - let bound = x => Math.max(0, Math.min(Math.round(x), getMapSize())); + let bound = x => Math.max(0, Math.min(Math.round(x), g_Map.getSize())); let startHeight = args.startHeight !== undefined ? args.startHeight : g_Map.getHeight(new Vector2D(bound(args.start.x), bound(args.start.y))); let endHeight = args.endHeight !== undefined ? args.endHeight : g_Map.getHeight(new Vector2D(bound(args.end.x), bound(args.end.y))); diff --git a/binaries/data/mods/public/maps/random/rmgen/library.js b/binaries/data/mods/public/maps/random/rmgen/library.js index 2003732d7c..f1289391ae 100644 --- a/binaries/data/mods/public/maps/random/rmgen/library.js +++ b/binaries/data/mods/public/maps/random/rmgen/library.js @@ -261,7 +261,7 @@ function createObjectGroup(group, player, constraints) return group.place(player, new AndConstraint(constraints)); } -function getMapSize() +function g_Map.getSize() { return g_Map.size; } diff --git a/binaries/data/mods/public/maps/random/rmgen/painter.js b/binaries/data/mods/public/maps/random/rmgen/painter.js index ee56f37161..e1ce3f9976 100644 --- a/binaries/data/mods/public/maps/random/rmgen/painter.js +++ b/binaries/data/mods/public/maps/random/rmgen/painter.js @@ -83,7 +83,7 @@ LayeredPainter.prototype.paint = function(area) breadthFirstSearchPaint({ "area": area, "brushSize": 1, - "gridSize": getMapSize(), + "gridSize": g_Map.getSize(), "withinArea": (areaID, position) => g_Map.area[position.x][position.y] == areaID, "paintTile": (point, distance) => { let width = 0; diff --git a/binaries/data/mods/public/maps/random/rmgen/placer_centered.js b/binaries/data/mods/public/maps/random/rmgen/placer_centered.js index 785f72578e..e91f257fa1 100644 --- a/binaries/data/mods/public/maps/random/rmgen/placer_centered.js +++ b/binaries/data/mods/public/maps/random/rmgen/placer_centered.js @@ -36,7 +36,7 @@ ClumpPlacer.prototype.place = function(constraint) var retVec = []; - var size = getMapSize(); + var size = g_Map.getSize(); var gotRet = new Array(size).fill(0).map(p => new Uint8Array(size)); // booleans var radius = Math.sqrt(this.size / Math.PI); var perim = 4 * radius * 2 * Math.PI; @@ -150,7 +150,7 @@ ChainPlacer.prototype.place = function(constraint) return undefined; var retVec = []; - var size = getMapSize(); + var size = g_Map.getSize(); var failed = 0, count = 0; var queueEmpty = !this.q.length; diff --git a/binaries/data/mods/public/maps/random/rmgen/placer_noncentered.js b/binaries/data/mods/public/maps/random/rmgen/placer_noncentered.js index 4c0e24ffe2..02bf14ea83 100644 --- a/binaries/data/mods/public/maps/random/rmgen/placer_noncentered.js +++ b/binaries/data/mods/public/maps/random/rmgen/placer_noncentered.js @@ -9,7 +9,7 @@ */ function RectPlacer(x1, z1, x2, z2) { - let mapSize = getMapSize(); + let mapSize = g_Map.getSize(); this.x1 = Math.round(Math.max(Math.min(x1, x2), 0)); this.x2 = Math.round(Math.min(Math.max(x1, x2), mapSize - 1)); @@ -74,7 +74,7 @@ function HeightPlacer(mode, minElevation, maxElevation) HeightPlacer.prototype.place = function(constraint) { - let mapSize = getMapSize(); + let mapSize = g_Map.getSize(); let points = []; for (let x = 0; x < mapSize; ++x) @@ -127,7 +127,7 @@ PathPlacer.prototype.place = function(constraint) var totalSteps = numSteps*numISteps; var offset = 1 + Math.floor(pathLength / 4 * this.c); - var size = getMapSize(); + var size = g_Map.getSize(); var gotRet = []; for (var i = 0; i < size; ++i) gotRet[i] = new Uint8Array(size); // bool / uint8 diff --git a/binaries/data/mods/public/maps/random/rmgen/player.js b/binaries/data/mods/public/maps/random/rmgen/player.js index 00f1a80210..097ac3ec3f 100644 --- a/binaries/data/mods/public/maps/random/rmgen/player.js +++ b/binaries/data/mods/public/maps/random/rmgen/player.js @@ -84,7 +84,7 @@ function placeCivDefaultStartingEntities(location, playerID, wallType, dist = 6, function placeStartingWalls(x, z, playerID, wallType, orientation = BUILDING_ORIENTATION) { let civ = getCivCode(playerID); - if (civ != "iber" || getMapSize() <= 128) + if (civ != "iber" || g_Map.getSize() <= 128) return; if (wallType == "towers") @@ -543,7 +543,7 @@ function playerPlacementRiver(angle, width, center = undefined) { let numPlayers = getNumPlayers(); let numPlayersEven = numPlayers % 2 == 0; - let mapSize = getMapSize(); + let mapSize = g_Map.getSize(); let centerPosition = center || g_Map.getCenter(); let playerPosition = []; diff --git a/binaries/data/mods/public/maps/random/rmgen2/gaia.js b/binaries/data/mods/public/maps/random/rmgen2/gaia.js index 2d547fbaba..4b97016dc0 100644 --- a/binaries/data/mods/public/maps/random/rmgen2/gaia.js +++ b/binaries/data/mods/public/maps/random/rmgen2/gaia.js @@ -1121,7 +1121,7 @@ function findClearLine(bb, corners, angle, baseHeight) function findCorners(points) { // Find the bounding box of the terrain feature - var mapSize = getMapSize(); + var mapSize = g_Map.getSize(); var minX = mapSize + 1; var minZ = mapSize + 1; var maxX = -1; @@ -1187,7 +1187,7 @@ function paintHeightmap(mapName, func = undefined) */ let mapData = Engine.ReadJSONFile("maps/random/" + mapName + ".hmap"); - let mapSize = getMapSize(); // Width of the map in terrain tiles + let mapSize = g_Map.getSize(); // Width of the map in terrain tiles let hmSize = Math.sqrt(mapData.heightmap.length); let scale = hmSize / (mapSize + 1); // There are mapSize + 1 vertices (each 1 tile is surrounded by 2x2 vertices) diff --git a/binaries/data/mods/public/maps/random/rmgen2/setup.js b/binaries/data/mods/public/maps/random/rmgen2/setup.js index d21c476506..9e5015015a 100644 --- a/binaries/data/mods/public/maps/random/rmgen2/setup.js +++ b/binaries/data/mods/public/maps/random/rmgen2/setup.js @@ -153,7 +153,7 @@ function createBase(player, walls = true) "playerPosition": player.position, "PlayerTileClass": g_TileClasses.player, "BaseResourceClass": g_TileClasses.baseResource, - "Walls": getMapSize() > 192 && walls, + "Walls": g_Map.getSize() > 192 && walls, "CityPatch": { "outerTerrain": g_Terrains.roadWild, "innerTerrain": g_Terrains.road, @@ -220,7 +220,7 @@ function getTeamsArray() function randomStartingPositionPattern(teamsArray) { var formats = ["radial"]; - var mapSize = getMapSize(); + var mapSize = g_Map.getSize(); var numPlayers = getNumPlayers(); // Enable stronghold if we have a few teams and a big enough map diff --git a/binaries/data/mods/public/maps/random/saharan_oases.js b/binaries/data/mods/public/maps/random/saharan_oases.js index 15f7985faa..a4942aa0c0 100644 --- a/binaries/data/mods/public/maps/random/saharan_oases.js +++ b/binaries/data/mods/public/maps/random/saharan_oases.js @@ -39,7 +39,7 @@ const heightOffsetOasis = -3; var g_Map = new RandomMap(heightLand, tPrimary); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/sahel.js b/binaries/data/mods/public/maps/random/sahel.js index 28e6b74159..9428a53070 100644 --- a/binaries/data/mods/public/maps/random/sahel.js +++ b/binaries/data/mods/public/maps/random/sahel.js @@ -33,7 +33,7 @@ const heightLand = 1; var g_Map = new RandomMap(heightLand, tPrimary); var numPlayers = getNumPlayers(); -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); var clPlayer = createTileClass(); var clForest = createTileClass(); 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 7b6fa770f9..a53f778182 100644 --- a/binaries/data/mods/public/maps/random/sahel_watering_holes.js +++ b/binaries/data/mods/public/maps/random/sahel_watering_holes.js @@ -44,7 +44,7 @@ const heightOffsetBump = 2; var g_Map = new RandomMap(heightLand, tGrass); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/schwarzwald.js b/binaries/data/mods/public/maps/random/schwarzwald.js index 10216009ac..76c32a2a9f 100644 --- a/binaries/data/mods/public/maps/random/schwarzwald.js +++ b/binaries/data/mods/public/maps/random/schwarzwald.js @@ -78,7 +78,7 @@ var clFood = createTileClass(); var clBaseResource = createTileClass(); var clOpen = createTileClass(); -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); var mapCenter = g_Map.getCenter(); var mapRadius = mapSize/2; diff --git a/binaries/data/mods/public/maps/random/snowflake_searocks.js b/binaries/data/mods/public/maps/random/snowflake_searocks.js index 988d6fc2e7..94d5b09fb4 100644 --- a/binaries/data/mods/public/maps/random/snowflake_searocks.js +++ b/binaries/data/mods/public/maps/random/snowflake_searocks.js @@ -44,7 +44,7 @@ const heightSeaGround = -5; var g_Map = new RandomMap(heightSeaGround, tWater); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/survivalofthefittest.js b/binaries/data/mods/public/maps/random/survivalofthefittest.js index b4b30c2fc6..1e3e97c57f 100644 --- a/binaries/data/mods/public/maps/random/survivalofthefittest.js +++ b/binaries/data/mods/public/maps/random/survivalofthefittest.js @@ -45,7 +45,7 @@ const heightHill = 30; var g_Map = new RandomMap(heightHill, tMainTerrain); var numPlayers = getNumPlayers(); -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); var mapCenter = g_Map.getCenter(); var clPlayer = createTileClass(); diff --git a/binaries/data/mods/public/maps/random/the_nile.js b/binaries/data/mods/public/maps/random/the_nile.js index 43d660348b..85c1c42ecb 100644 --- a/binaries/data/mods/public/maps/random/the_nile.js +++ b/binaries/data/mods/public/maps/random/the_nile.js @@ -47,7 +47,7 @@ const heightOffsetBump = 2; var g_Map = new RandomMap(heightLand, tPrimary); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); const mapBounds = g_Map.getBounds(); diff --git a/binaries/data/mods/public/maps/random/the_unknown/unknown_common.js b/binaries/data/mods/public/maps/random/the_unknown/unknown_common.js index b69fb934b4..025487379e 100644 --- a/binaries/data/mods/public/maps/random/the_unknown/unknown_common.js +++ b/binaries/data/mods/public/maps/random/the_unknown/unknown_common.js @@ -59,7 +59,7 @@ const heightOffsetBump = 2; var g_Map = new RandomMap(heightSeaGround, tWater); const numPlayers = getNumPlayers(); -const mapSize = getMapSize(); +const mapSize = g_Map.getSize(); const mapCenter = g_Map.getCenter(); const mapBounds = g_Map.getBounds(); diff --git a/binaries/data/mods/public/maps/random/wall_demo.js b/binaries/data/mods/public/maps/random/wall_demo.js index 394ea04720..d6cf5d51f0 100644 --- a/binaries/data/mods/public/maps/random/wall_demo.js +++ b/binaries/data/mods/public/maps/random/wall_demo.js @@ -42,7 +42,7 @@ var g_Map = new RandomMap(0, "grass1"); * And have fun! */ -var mapSize = getMapSize(); +var mapSize = g_Map.getSize(); /** * General wall placement setup