diff --git a/binaries/data/mods/public/maps/random/aegean_sea.js b/binaries/data/mods/public/maps/random/aegean_sea.js index c799f3f928..4777e36962 100644 --- a/binaries/data/mods/public/maps/random/aegean_sea.js +++ b/binaries/data/mods/public/maps/random/aegean_sea.js @@ -233,7 +233,7 @@ createDecoration( ] ], [ - scaleByMapSize(16, 262), + scaleByMapAreaAbsolute(16), scaleByMapSize(40, 360) ], avoidClasses(clWater, 2, clForest, 0, clPlayer, 0, clHill, 1)); diff --git a/binaries/data/mods/public/maps/random/african_plains.js b/binaries/data/mods/public/maps/random/african_plains.js index d67b69f82b..163929a6a6 100644 --- a/binaries/data/mods/public/maps/random/african_plains.js +++ b/binaries/data/mods/public/maps/random/african_plains.js @@ -192,8 +192,8 @@ createDecoration( [new SimpleObject(aRock, 1,2, 0,1)] ], [ - scaleByMapSize(8, 131), - scaleByMapSize(8, 131) + scaleByMapAreaAbsolute(8), + scaleByMapAreaAbsolute(8) ], avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clHill, 0)); Engine.SetProgress(75); diff --git a/binaries/data/mods/public/maps/random/alpine_lakes.js b/binaries/data/mods/public/maps/random/alpine_lakes.js index 814e8b9603..3dbfacd528 100644 --- a/binaries/data/mods/public/maps/random/alpine_lakes.js +++ b/binaries/data/mods/public/maps/random/alpine_lakes.js @@ -205,11 +205,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13) ], avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clHill, 0)); diff --git a/binaries/data/mods/public/maps/random/archipelago.js b/binaries/data/mods/public/maps/random/archipelago.js index 3820f05541..7773fd3273 100644 --- a/binaries/data/mods/public/maps/random/archipelago.js +++ b/binaries/data/mods/public/maps/random/archipelago.js @@ -203,11 +203,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13) ], [avoidClasses(clForest, 0, clPlayer, 0, clHill, 0), stayClasses(clLand, 5)]); Engine.SetProgress(70); diff --git a/binaries/data/mods/public/maps/random/arctic_summer.js b/binaries/data/mods/public/maps/random/arctic_summer.js index f104aca068..60660ae426 100644 --- a/binaries/data/mods/public/maps/random/arctic_summer.js +++ b/binaries/data/mods/public/maps/random/arctic_summer.js @@ -221,8 +221,8 @@ createDecoration( ] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), ], avoidClasses( clWater, 0, diff --git a/binaries/data/mods/public/maps/random/atlas_mountains.js b/binaries/data/mods/public/maps/random/atlas_mountains.js index 96bfb7c24e..6084627284 100644 --- a/binaries/data/mods/public/maps/random/atlas_mountains.js +++ b/binaries/data/mods/public/maps/random/atlas_mountains.js @@ -145,11 +145,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13) ], avoidClasses(clForest, 0, clPlayer, 0, clHill, 0)); diff --git a/binaries/data/mods/public/maps/random/cantabrian_highlands.js b/binaries/data/mods/public/maps/random/cantabrian_highlands.js index b2aae8f21c..8a5e137213 100644 --- a/binaries/data/mods/public/maps/random/cantabrian_highlands.js +++ b/binaries/data/mods/public/maps/random/cantabrian_highlands.js @@ -224,11 +224,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13) ], avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clHill, 0)); Engine.SetProgress(70); diff --git a/binaries/data/mods/public/maps/random/canyon.js b/binaries/data/mods/public/maps/random/canyon.js index 644e5744cc..cadad3bd74 100644 --- a/binaries/data/mods/public/maps/random/canyon.js +++ b/binaries/data/mods/public/maps/random/canyon.js @@ -285,11 +285,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - 3 * scaleByMapSize(16, 262), - 3 * scaleByMapSize(8, 131), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200) + 3 * scaleByMapAreaAbsolute(16), + 3 * scaleByMapAreaAbsolute(8), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13) ], avoidClasses(clForest, 0, clPlayer, 0, clHill, 0)); diff --git a/binaries/data/mods/public/maps/random/continent.js b/binaries/data/mods/public/maps/random/continent.js index 2ec9b33422..ff2c76882a 100644 --- a/binaries/data/mods/public/maps/random/continent.js +++ b/binaries/data/mods/public/maps/random/continent.js @@ -196,11 +196,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13) ], [avoidClasses(clForest, 0, clPlayer, 0, clHill, 0), stayClasses(clLand, 5)]); diff --git a/binaries/data/mods/public/maps/random/corinthian_isthmus.js b/binaries/data/mods/public/maps/random/corinthian_isthmus.js index 25e366219e..a858bc584d 100644 --- a/binaries/data/mods/public/maps/random/corinthian_isthmus.js +++ b/binaries/data/mods/public/maps/random/corinthian_isthmus.js @@ -253,7 +253,7 @@ createDecoration( ] ], [ - scaleByMapSize(16, 262), + scaleByMapAreaAbsolute(16), scaleByMapSize(40, 360) ], avoidClasses(clWater, 2, clForest, 0, clPlayer, 5, clBaseResource, 6, clHill, 1, clRock, 6, clMetal, 6)); diff --git a/binaries/data/mods/public/maps/random/danubius.js b/binaries/data/mods/public/maps/random/danubius.js index d6c3aa6f37..0063e1cad7 100644 --- a/binaries/data/mods/public/maps/random/danubius.js +++ b/binaries/data/mods/public/maps/random/danubius.js @@ -554,15 +554,15 @@ for (let i = 0; i < 2; ++i) [new SimpleObject(aFerns, 2, 5, 2, 4)] ], [ - scaleByMapSize(5, 80), - scaleByMapSize(5, 80), - scaleByMapSize(5, 80), - scaleByMapSize(5, 80), + scaleByMapAreaAbsolute(5), + scaleByMapAreaAbsolute(5), + scaleByMapAreaAbsolute(5), + scaleByMapAreaAbsolute(5), - scaleByMapSize(5, 80), - scaleByMapSize(5, 80), - scaleByMapSize(5, 80), - scaleByMapSize(5, 80), + scaleByMapAreaAbsolute(5), + scaleByMapAreaAbsolute(5), + scaleByMapAreaAbsolute(5), + scaleByMapAreaAbsolute(5), scaleByMapSize(20, 80) ], diff --git a/binaries/data/mods/public/maps/random/dodecanese.js b/binaries/data/mods/public/maps/random/dodecanese.js index 48e5d5e49f..df4bfc4fc9 100644 --- a/binaries/data/mods/public/maps/random/dodecanese.js +++ b/binaries/data/mods/public/maps/random/dodecanese.js @@ -324,7 +324,7 @@ createDecoration( ] ], [ - scaleByMapSize(16, 262), + scaleByMapAreaAbsolute(16), scaleByMapSize(40, 360) ], avoidClasses(clWater, 4, clPlayer, 5, clVolcano, 4, clForest, 1, clBaseResource, 4, clRock, 4, clMetal, 4, clHill, 1)); diff --git a/binaries/data/mods/public/maps/random/english_channel.js b/binaries/data/mods/public/maps/random/english_channel.js index 7c0bb6548f..9bae156fb9 100644 --- a/binaries/data/mods/public/maps/random/english_channel.js +++ b/binaries/data/mods/public/maps/random/english_channel.js @@ -190,11 +190,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13) ], avoidClasses(clWater, 1, clForest, 0, clPlayer, 0, clHill, 0)); diff --git a/binaries/data/mods/public/maps/random/extinct_volcano.js b/binaries/data/mods/public/maps/random/extinct_volcano.js index a14e0410df..f902d49a55 100644 --- a/binaries/data/mods/public/maps/random/extinct_volcano.js +++ b/binaries/data/mods/public/maps/random/extinct_volcano.js @@ -317,9 +317,9 @@ createDecoration( ] ], [ - scaleByMapSize(15, 200), - scaleByMapSize(15, 200), - scaleByMapSize(15, 200) + scaleByMapAreaAbsolute(15), + scaleByMapAreaAbsolute(15), + scaleByMapAreaAbsolute(15) ], [ stayClasses(clGrass, 0), diff --git a/binaries/data/mods/public/maps/random/flood.js b/binaries/data/mods/public/maps/random/flood.js index c35c40abe4..6289940ea3 100644 --- a/binaries/data/mods/public/maps/random/flood.js +++ b/binaries/data/mods/public/maps/random/flood.js @@ -265,11 +265,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 5, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13) ], avoidClasses(clForest, 2, clPlayer, 20, clMountain, 5, clFood, 1, clBaseResource, 2)); diff --git a/binaries/data/mods/public/maps/random/fortress.js b/binaries/data/mods/public/maps/random/fortress.js index a235fa3ab5..2809a5e409 100644 --- a/binaries/data/mods/public/maps/random/fortress.js +++ b/binaries/data/mods/public/maps/random/fortress.js @@ -239,11 +239,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13) ], avoidClasses(clWater, 0, clForest, 0, clPlayer, 1, clHill, 0)); Engine.SetProgress(80); diff --git a/binaries/data/mods/public/maps/random/gear.js b/binaries/data/mods/public/maps/random/gear.js index 3c0bca642e..abc30768ce 100644 --- a/binaries/data/mods/public/maps/random/gear.js +++ b/binaries/data/mods/public/maps/random/gear.js @@ -273,11 +273,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13) ], avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clHill, 0)); diff --git a/binaries/data/mods/public/maps/random/guadalquivir_river.js b/binaries/data/mods/public/maps/random/guadalquivir_river.js index 99327823f3..c448688d5d 100644 --- a/binaries/data/mods/public/maps/random/guadalquivir_river.js +++ b/binaries/data/mods/public/maps/random/guadalquivir_river.js @@ -204,11 +204,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13) ], [avoidClasses(clPlayer, 1, clDirt, 1, clRiver, 1), stayClasses(clLand, 6)]); @@ -219,8 +219,8 @@ createDecoration( [new SimpleObject(aLillies, 1, 2, 0, 1)] ], [ - scaleByMapSize(800, 12800), - scaleByMapSize(800, 12800) + scaleByMapAreaAbsolute(800), + scaleByMapAreaAbsolute(800) ], stayClasses(clShallow, 0)); 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 9409f8288b..dd9df47d68 100644 --- a/binaries/data/mods/public/maps/random/gulf_of_bothnia.js +++ b/binaries/data/mods/public/maps/random/gulf_of_bothnia.js @@ -203,8 +203,8 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), scaleByMapSize(bushCount.min, bushCount.max), scaleByMapSize(bushCount.min, bushCount.max), scaleByMapSize(bushCount.min, bushCount.max) diff --git a/binaries/data/mods/public/maps/random/hellas.js b/binaries/data/mods/public/maps/random/hellas.js index 7d630b0011..386af6470c 100644 --- a/binaries/data/mods/public/maps/random/hellas.js +++ b/binaries/data/mods/public/maps/random/hellas.js @@ -445,10 +445,10 @@ for (let biome of ["lowlands", "highlands"]) ] ], [ - scaleByMapSize(20, 300), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(20), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13) ], [ biome == "highlands" ? constraintHighlands : constraintLowlands, @@ -460,7 +460,7 @@ for (let biome of ["lowlands", "highlands"]) biomes[biome].actors.stones.map(template => new SimpleObject(actorTemplate(template), 1, 3, 0, 1)) ], [ - biomes[biome].actors.stones.map(template => scaleByMapSize(2, 40) * randIntInclusive(1, 3)) + biomes[biome].actors.stones.map(template => scaleByMapAreaAbsolute(2) * randIntInclusive(1, 3)) ], [ biome == "highlands" ? constraintHighlands : constraintLowlands, diff --git a/binaries/data/mods/public/maps/random/lake.js b/binaries/data/mods/public/maps/random/lake.js index 7ee530230d..ec1c29c35b 100644 --- a/binaries/data/mods/public/maps/random/lake.js +++ b/binaries/data/mods/public/maps/random/lake.js @@ -194,11 +194,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13) ], avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clHill, 0)); diff --git a/binaries/data/mods/public/maps/random/mainland.js b/binaries/data/mods/public/maps/random/mainland.js index 4ea09923b7..6e983d8857 100644 --- a/binaries/data/mods/public/maps/random/mainland.js +++ b/binaries/data/mods/public/maps/random/mainland.js @@ -149,11 +149,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13) ], avoidClasses(clForest, 0, clPlayer, 0, clHill, 0)); diff --git a/binaries/data/mods/public/maps/random/polar_sea.js b/binaries/data/mods/public/maps/random/polar_sea.js index 37e3c67b2d..e71f17420d 100644 --- a/binaries/data/mods/public/maps/random/polar_sea.js +++ b/binaries/data/mods/public/maps/random/polar_sea.js @@ -178,8 +178,8 @@ createDecoration( ] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), ], avoidClasses(clWater, 0, clPlayer, 0)); @@ -188,7 +188,7 @@ createDecoration( [new SimpleObject(aIceberg, 1, 1, 1, 1)] ], [ - scaleByMapSize(8, 131) + scaleByMapAreaAbsolute(8) ], [stayClasses(clWater, 4), avoidClasses(clHill, 2)]); Engine.SetProgress(80); diff --git a/binaries/data/mods/public/maps/random/ratumacos.js b/binaries/data/mods/public/maps/random/ratumacos.js index 4efb2a3857..19669b14c1 100644 --- a/binaries/data/mods/public/maps/random/ratumacos.js +++ b/binaries/data/mods/public/maps/random/ratumacos.js @@ -320,8 +320,8 @@ createDecoration( [new SimpleObject(g_Decoratives.lillies, 1, 2, 0, 1)] ], [ - 200 * Math.pow(scaleByMapSize(3, 12), 2), - 100 * Math.pow(scaleByMapSize(3, 12), 2) + scaleByMapAreaAbsolute(1800), + scaleByMapAreaAbsolute(900) ], new HeightConstraint(heightReedsMin, heightShoreline) ); diff --git a/binaries/data/mods/public/maps/random/rivers.js b/binaries/data/mods/public/maps/random/rivers.js index eaa8a1dd12..2a706df138 100644 --- a/binaries/data/mods/public/maps/random/rivers.js +++ b/binaries/data/mods/public/maps/random/rivers.js @@ -220,11 +220,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13) ], avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clHill, 0)); @@ -234,8 +234,8 @@ createDecoration( [new SimpleObject(aLillies, 1, 2, 0, 1)] ], [ - scaleByMapSize(800, 12800), - scaleByMapSize(800, 12800) + scaleByMapAreaAbsolute(800), + scaleByMapAreaAbsolute(800) ], stayClasses(clShallow, 0)); diff --git a/binaries/data/mods/public/maps/random/rmgen/RandomMap.js b/binaries/data/mods/public/maps/random/rmgen/RandomMap.js index a2a233ab53..93c7d5ad89 100644 --- a/binaries/data/mods/public/maps/random/rmgen/RandomMap.js +++ b/binaries/data/mods/public/maps/random/rmgen/RandomMap.js @@ -138,6 +138,11 @@ RandomMap.prototype.getSize = function() return this.size; }; +RandomMap.prototype.getArea = function(size = this.size) +{ + return this.isCircularMap ? diskArea(size / 2) : size * size; +}; + /** * Returns the center tile coordinates of the map. */ diff --git a/binaries/data/mods/public/maps/random/rmgen/library.js b/binaries/data/mods/public/maps/random/rmgen/library.js index 721a9bb0a4..7cd7527cc5 100644 --- a/binaries/data/mods/public/maps/random/rmgen/library.js +++ b/binaries/data/mods/public/maps/random/rmgen/library.js @@ -80,6 +80,26 @@ function scaleByMapSize(min, max, minMapSize = 128, maxMapSize = 512) return min + (max - min) * (g_MapSettings.Size - minMapSize) / (maxMapSize - minMapSize); } +/** + * Interpolate quadratic between (min, minMapArea) and (max, maxMapArea) with respect to the mapSize. + * Default values set on the area of tiny and giant map sizes according to the map shape (square or circular). + */ +function scaleByMapArea(min, max, minMapArea = g_Map.getArea(128), maxMapArea = g_Map.getArea(256)) +{ + return min + (max - min) * (g_Map.getArea() - minMapArea) / (maxMapArea - minMapArea); +} + +/** + * Interpolate quadraticly between (0,0) and (base, baseArea) with respect to the map size. + * @param base - Value we should attain at baseArea. + * @param disallowedArea - Area deducted from the map area. + * @param baseArea - Area at which the base value should be attained. Defaults to the map area of a tiny map of current shape (square or circular). + */ +function scaleByMapAreaAbsolute(base, disallowedArea = 0, baseArea = g_Map.getArea(128)) +{ + return scaleByMapArea(0, base, disallowedArea, baseArea + disallowedArea); +} + function randomPositionOnTile(tilePosition) { return Vector2D.add(tilePosition, new Vector2D(randFloat(0, 1), randFloat(0, 1))); diff --git a/binaries/data/mods/public/maps/random/schwarzwald.js b/binaries/data/mods/public/maps/random/schwarzwald.js index 793b323265..173c4b49bb 100644 --- a/binaries/data/mods/public/maps/random/schwarzwald.js +++ b/binaries/data/mods/public/maps/random/schwarzwald.js @@ -244,11 +244,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200), - scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13), + scaleByMapAreaAbsolute(13) ], avoidClasses(clForest, 1, clPlayer, 0, clPath, 3, clWater, 3)); diff --git a/binaries/data/mods/public/maps/random/scythian_rivulet.js b/binaries/data/mods/public/maps/random/scythian_rivulet.js index 28d32bc05e..3408596c2a 100644 --- a/binaries/data/mods/public/maps/random/scythian_rivulet.js +++ b/binaries/data/mods/public/maps/random/scythian_rivulet.js @@ -233,7 +233,7 @@ createDecoration( ] ], [ - scaleByMapSize(16, 262), + scaleByMapAreaAbsolute(16), scaleByMapSize(40, 360) ], avoidClasses(clWater, 2, clForest, 0, clPlayer, 20, clHill, 1)); diff --git a/binaries/data/mods/public/maps/random/survivalofthefittest.js b/binaries/data/mods/public/maps/random/survivalofthefittest.js index d64acbcc84..26fadeccba 100644 --- a/binaries/data/mods/public/maps/random/survivalofthefittest.js +++ b/binaries/data/mods/public/maps/random/survivalofthefittest.js @@ -186,11 +186,11 @@ createDecoration( [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] ], [ - scaleByMapSize(16, 262), - scaleByMapSize(8, 131), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200), - planetm * scaleByMapSize(13, 200) + scaleByMapAreaAbsolute(16), + scaleByMapAreaAbsolute(8), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13), + planetm * scaleByMapAreaAbsolute(13) ], [avoidClasses(clForest, 0, clPlayer, 0, clHill, 0), landConstraint]); Engine.SetProgress(90);