Setup cultureTree after map load

This commit is contained in:
hasparus 2018-10-30 09:50:06 +01:00
parent dc70a86613
commit a2090ac2f3
No known key found for this signature in database
GPG key ID: 199946486FC7B0AC

View file

@ -278,6 +278,7 @@ function fantasyMap() {
makeFileFromUrl(decodeURIComponent(mapLink)).then(blob => { makeFileFromUrl(decodeURIComponent(mapLink)).then(blob => {
uploadFile(blob); uploadFile(blob);
manorsAndRegions(); // namesBase global state manorsAndRegions(); // namesBase global state
cleanData();
}) })
} else { } else {
applyNamesData(); // apply default namesbase on load applyNamesData(); // apply default namesbase on load
@ -7049,8 +7050,12 @@ function fantasyMap() {
points = JSON.parse(data[1]); points = JSON.parse(data[1]);
cells = JSON.parse(data[2]); cells = JSON.parse(data[2]);
manors = JSON.parse(data[3]); manors = JSON.parse(data[3]);
if (data[7]) cultures = JSON.parse(data[7]); if (data[7]) {
if (data[7] === undefined) generateCultures(); cultures = JSON.parse(data[7]);
cultureTree = d3.quadtree(cultures.map(c => c.center));
} else {
generateCultures();
}
if (data[11]) notes = JSON.parse(data[11]); if (data[11]) notes = JSON.parse(data[11]);
// place random point // place random point