Index: binaries/data/mods/public/maps/random/mainland.js =================================================================== --- binaries/data/mods/public/maps/random/mainland.js +++ binaries/data/mods/public/maps/random/mainland.js @@ -149,11 +149,11 @@ [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)); Index: binaries/data/mods/public/maps/random/rmgen/library.js =================================================================== --- binaries/data/mods/public/maps/random/rmgen/library.js +++ binaries/data/mods/public/maps/random/rmgen/library.js @@ -80,6 +80,36 @@ 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_MapSettings.CircularMap ? diskArea(64) : 16384, + maxMapArea = g_MapSettings.CircularMap ? diskArea(256) : 262144) +{ + return min + (max - min) * + ((g_MapSettings.CircularMap ? + diskArea(g_MapSettings.Size / 2) : + g_MapSettings.Size * g_MapSettings.Size) - 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_MapSettings.CircularMap ? diskArea(64) : 16384) +{ + return scaleByMapArea(0, base, disallowedArea, baseArea + disallowedArea); +} + function randomPositionOnTile(tilePosition) { return Vector2D.add(tilePosition, new Vector2D(randFloat(0, 1), randFloat(0, 1)));