updated resampler

This commit is contained in:
Mészáros Gergely 2021-08-15 04:43:01 +02:00
parent 01cc1eec30
commit a3c81b24d1
2 changed files with 20 additions and 3 deletions

View file

@ -64,13 +64,18 @@ window.Submap = (function () {
baseState.pack.rivers.forEach(r =>
r.cells.forEach(oldc => {
const targetCells = forwardGridMap[oldc];
if (!targetCells) {
console.error('Targetcells is empty');
console.log("oldc,gridmap", oldc, forwardGridMap);
return;
}
targetCells.forEach(c => {
if (grid.cells.t[c]<1) return;
rbeds[c] = 1;
});
})
);
// raise every land cell a bit
// raise every land cell a bit except riverbeds
grid.cells.h.forEach((h, i) => {
if (!rbeds[i] || grid.cells.t[i]<1) return;
grid.cells.h[i] = Math.min(grid.cells.h[i] * 1.1, 255);
@ -78,7 +83,8 @@ window.Submap = (function () {
}
markupGridOcean();
addLakesInDeepDepressions();
if (options.addLakesInDepressions)
addLakesInDeepDepressions();
// openNearSeaLakes();
OceanLayers();
// defineMapSize(); // not needed (not random)
@ -150,9 +156,19 @@ window.Submap = (function () {
// transfer basemap cultures
pack.cultures = baseState.pack.cultures
// fix culture centers
const validCultures = new Set(pack.cells.culture);
pack.cultures.forEach((c, i) => {
if (!validCultures.has(c)) {
c.removed = true;
c.center = undefined;
} else {
c.center = pack.cells.culture.findIndex(x => x===c);
}
});
// Cultures.generate();
// Cultures.expand();
// TODO: update culture centers
// transfer states, mark states without land as removed.
const validStates = new Set(pack.cells.state);

View file

@ -22,6 +22,7 @@ const generateSubmap = debounce(async function () {
const settings = {
promoteTown: Boolean(document.getElementById("submapPromoteTown").checked),
depressRivers: Boolean(document.getElementById("submapDepressRivers").checked),
addLakesInDepressions: Boolean(document.getElementById("submapAddLakeInDepression").checked),
}
// Create projection func from current zoom extents