mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
rivers: if points data is wrong, ignore points
This commit is contained in:
parent
ab3c8c9e04
commit
fc971e4902
1 changed files with 6 additions and 0 deletions
|
|
@ -1481,6 +1481,12 @@ function drawRivers() {
|
|||
|
||||
const riverPaths = pack.rivers.map(({cells, points, i, widthFactor, sourceWidth}) => {
|
||||
if (!cells || cells.length < 2) return;
|
||||
|
||||
if (points && points.length !== cells.length) {
|
||||
console.error(`River ${i} has ${cells.length} cells, but only ${points.length} points defined. Resetting points data`);
|
||||
points = undefined;
|
||||
}
|
||||
|
||||
const meanderedPoints = addMeandering(cells, points);
|
||||
const path = getRiverPath(meanderedPoints, widthFactor, sourceWidth);
|
||||
return `<path id="river${i}" d="${path}"/>`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue