mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-19 10:31:24 +01:00
refactor: submap - restore lake names
This commit is contained in:
parent
b00c968091
commit
431a5aa3e9
1 changed files with 16 additions and 1 deletions
|
|
@ -47,9 +47,9 @@ window.Submap = (function () {
|
||||||
restoreProvinces(parentMap);
|
restoreProvinces(parentMap);
|
||||||
restoreMarkers(parentMap, projection);
|
restoreMarkers(parentMap, projection);
|
||||||
restoreZones(parentMap, projection, options);
|
restoreZones(parentMap, projection, options);
|
||||||
|
restoreFeatureDetails(parentMap, inverse);
|
||||||
|
|
||||||
Rivers.specify();
|
Rivers.specify();
|
||||||
Features.specify();
|
|
||||||
|
|
||||||
showStatistics();
|
showStatistics();
|
||||||
}
|
}
|
||||||
|
|
@ -277,6 +277,21 @@ window.Submap = (function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function restoreFeatureDetails(parentMap, inverse) {
|
||||||
|
pack.features.forEach(feature => {
|
||||||
|
if (!feature) return;
|
||||||
|
const [x, y] = pack.cells.p[feature.firstCell];
|
||||||
|
const [parentX, parentY] = inverse(x, y);
|
||||||
|
const parentCell = parentMap.pack.cells.q.find(parentX, parentY, Infinity)[2];
|
||||||
|
if (parentCell === undefined) return;
|
||||||
|
const parentFeature = parentMap.pack.features[parentMap.pack.cells.f[parentCell]];
|
||||||
|
|
||||||
|
if (parentFeature.group) feature.group = parentFeature.group;
|
||||||
|
if (parentFeature.name) feature.name = parentFeature.name;
|
||||||
|
if (parentFeature.height) feature.height = parentFeature.height;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function groupCellsByType(graph) {
|
function groupCellsByType(graph) {
|
||||||
return graph.cells.p.reduce(
|
return graph.cells.p.reduce(
|
||||||
(acc, [x, y], cellId) => {
|
(acc, [x, y], cellId) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue