mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
fix: don't return in cycle on error
This commit is contained in:
parent
0910aed11a
commit
a051698657
1 changed files with 14 additions and 8 deletions
|
|
@ -869,13 +869,17 @@ export function resolveVersionConflicts(version) {
|
||||||
pack.routes = [];
|
pack.routes = [];
|
||||||
const POINT_DISTANCE = grid.spacing * 0.75;
|
const POINT_DISTANCE = grid.spacing * 0.75;
|
||||||
|
|
||||||
routes.selectAll("g").each(function () {
|
for (const g of document.querySelectorAll("#viewbox > #routes > g")) {
|
||||||
const group = this.id;
|
const group = g.id;
|
||||||
if (!group) return;
|
if (!group) continue;
|
||||||
|
|
||||||
for (const node of this.querySelectorAll("path")) {
|
for (const node of g.querySelectorAll("path")) {
|
||||||
const totalLength = node.getTotalLength();
|
const totalLength = node.getTotalLength();
|
||||||
if (!totalLength) debugger;
|
if (!totalLength) {
|
||||||
|
ERROR && console.error("Route path has zero length", node);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const increment = totalLength / Math.ceil(totalLength / POINT_DISTANCE);
|
const increment = totalLength / Math.ceil(totalLength / POINT_DISTANCE);
|
||||||
const points = [];
|
const points = [];
|
||||||
|
|
||||||
|
|
@ -887,15 +891,17 @@ export function resolveVersionConflicts(version) {
|
||||||
points.push([x, y, cellId]);
|
points.push([x, y, cellId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (points.length < 2) return;
|
if (points.length < 2) {
|
||||||
|
ERROR && console.error("Route path has less than 2 points", node);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const secondCellId = points[1][2];
|
const secondCellId = points[1][2];
|
||||||
const feature = pack.cells.f[secondCellId];
|
const feature = pack.cells.f[secondCellId];
|
||||||
|
|
||||||
pack.routes.push({i: pack.routes.length, group, feature, points});
|
pack.routes.push({i: pack.routes.length, group, feature, points});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
routes.selectAll("path").remove();
|
routes.selectAll("path").remove();
|
||||||
if (layerIsOn("toggleRoutes")) drawRoutes();
|
if (layerIsOn("toggleRoutes")) drawRoutes();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue