mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 20:04:13 +00:00
Change createPassage function from cfdd37f6d9 to optionally consume a Constraint argument instead of an optional maxHeight argument.
This allows constraining the passage using tileclasses for instance. This was SVN commit r21356.
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user