mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 10:01:23 +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);
|
||||
restoreMarkers(parentMap, projection);
|
||||
restoreZones(parentMap, projection, options);
|
||||
restoreFeatureDetails(parentMap, inverse);
|
||||
|
||||
Rivers.specify();
|
||||
Features.specify();
|
||||
|
||||
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) {
|
||||
return graph.cells.p.reduce(
|
||||
(acc, [x, y], cellId) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue