set size for pre-defined maps

This commit is contained in:
Azgaar 2022-02-19 21:18:02 +03:00
parent 7f13f1c367
commit 5b6ec0cc2e
9 changed files with 26 additions and 10 deletions

View file

@ -444,7 +444,7 @@ window.HeightmapGenerator = (function () {
for (let i = 0; i < cells.i.length; i++) {
const lightness = imageData[i * 4] / 255;
const powered = lightness < 0.2 ? lightness : 0.2 + (lightness - 0.2) ** 0.8;
cells.h[i] = minmax(rn(powered * 100), 0, 100);
cells.h[i] = minmax(Math.floor(powered * 100), 0, 100);
}
}

View file

@ -306,10 +306,8 @@ function showSeedHistoryDialog() {
// generate map with historical seed
function restoreSeed(id) {
if (mapHistory[id].seed == seed) {
tip("The current map is already generated with this seed", null, "error");
return;
}
if (mapHistory[id].seed == seed) return tip("The current map is already generated with this seed", null, "error");
optionsSeed.value = mapHistory[id].seed;
mapWidthInput.value = mapHistory[id].width;
mapHeightInput.value = mapHistory[id].height;