diff --git a/binaries/data/mods/public/maps/random/lorraine_plain.js b/binaries/data/mods/public/maps/random/lorraine_plain.js index f6c1b27d90..26a8449765 100644 --- a/binaries/data/mods/public/maps/random/lorraine_plain.js +++ b/binaries/data/mods/public/maps/random/lorraine_plain.js @@ -129,7 +129,7 @@ for (let i = 0; i <= randIntInclusive(3, scaleByMapSize(4, 6)); ++i) "smoothWidth": 2, "startHeight": heightShallows, "endHeight": heightShallows, - "maxHeight": heightShallows, + "constraint": new HeightConstraint(-Infinity, heightShallows), "tileClass": clShallow }); } diff --git a/binaries/data/mods/public/maps/random/ratumacos.js b/binaries/data/mods/public/maps/random/ratumacos.js index 46d74c4fe1..8faafa3257 100644 --- a/binaries/data/mods/public/maps/random/ratumacos.js +++ b/binaries/data/mods/public/maps/random/ratumacos.js @@ -86,8 +86,7 @@ for (let i = 0; i < scaleByMapSize(5, 12); ++i) "smoothWidth": 2, "startHeight": heightShallow, "endHeight": heightShallow, - "maxHeight": heightShallow, - "terrain": "blue" + "constraint": new HeightConstraint(-Infinity, heightShallow) }); } diff --git a/binaries/data/mods/public/maps/random/rmgen-common/gaia_terrain.js b/binaries/data/mods/public/maps/random/rmgen-common/gaia_terrain.js index 57e2da867c..23e2c47b67 100644 --- a/binaries/data/mods/public/maps/random/rmgen-common/gaia_terrain.js +++ b/binaries/data/mods/public/maps/random/rmgen-common/gaia_terrain.js @@ -509,9 +509,9 @@ function createTributaryRivers(riverAngle, riverCount, riverWidth, heightRiverbe "startWidth": scaleByMapSize(8, 12), "endWidth": scaleByMapSize(8, 12), "smoothWidth": 2, + "constraint": new HeightConstraint(-Infinity, heightShallow), "startHeight": heightShallow, "endHeight": heightShallow, - "maxHeight": heightShallow, "tileClass": shallowTileClass }); } @@ -523,6 +523,7 @@ function createTributaryRivers(riverAngle, riverCount, riverWidth, heightRiverbe * * @property {Vector2D} start - Location of the passage. * @property {Vector2D} end + * @property {Constraint} [constraint] - Only tiles that meet this constraint are changed. * @property {number} startWidth - Size of the passage (perpendicular to the direction of the passage). * @property {number} endWidth * @property {number} [startHeight] - Fixed height to be used if the height at the location shouldn't be used. @@ -557,7 +558,7 @@ function createPassage(args) let location = Vector2D.add(locationLength, Vector2D.mult(widthDirection, stepWidth)).round(); if (!g_Map.inMapBounds(location) || - args.maxHeight !== undefined && g_Map.getHeight(location) > args.maxHeight) + args.constraint && !args.constraint.allows(location)) continue; points.push(location); 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 05d2324686..0722fc3c0d 100644 --- a/binaries/data/mods/public/maps/random/sahel_watering_holes.js +++ b/binaries/data/mods/public/maps/random/sahel_watering_holes.js @@ -135,7 +135,7 @@ for (let i = 0; i < numPlayers; ++i) "smoothWidth": 4, "startHeight": heightShallows, "endHeight": heightShallows, - "maxHeight": heightShallows, + "constraint": new HeightConstraint(-Infinity, heightShallows), "tileClass": clShallows }); diff --git a/binaries/data/mods/public/maps/random/snowflake_searocks.js b/binaries/data/mods/public/maps/random/snowflake_searocks.js index 0730f14647..8d7a160170 100644 --- a/binaries/data/mods/public/maps/random/snowflake_searocks.js +++ b/binaries/data/mods/public/maps/random/snowflake_searocks.js @@ -263,7 +263,7 @@ for (let i = 0; i < numIslands; ++i) "startWidth": 11, "endWidth": 11, "smoothWidth": 3, - "maxHeight": heightIsland - 1, + "constraint": new HeightConstraint(-Infinity, heightIsland - 1), "tileClass": clLand, "terrain": tHill, "edgeTerrain": tCliff