Merge remote-tracking branch 'origin/master' into gui/lock-everything

# Conflicts:
#	index.html
#	versioning.js
This commit is contained in:
Guillaume St-Pierre 2022-12-10 16:29:58 -05:00
commit ae9ba6c077
9 changed files with 39 additions and 27 deletions

View file

@ -262,7 +262,7 @@ function getName(id) {
}
function getGraph(currentGraph) {
const newGraph = shouldRegenerateGrid(currentGraph) ? generateGrid() : deepCopy(currentGraph);
const newGraph = shouldRegenerateGrid(currentGraph, seed) ? generateGrid() : deepCopy(currentGraph);
delete newGraph.cells.h;
return newGraph;
}

View file

@ -452,7 +452,7 @@ function unlock(id) {
// check if option is locked
function locked(id) {
const lockEl = document.getElementById("lock_" + id);
return lockEl.dataset.locked == 1;
return lockEl.dataset.locked === "1";
}
// return key value stored in localStorage or null

View file

@ -1041,8 +1041,10 @@ function editHeightmap(options) {
const steps = byId("templateBody").querySelectorAll("#templateBody > div");
if (!steps.length) return;
const seed = byId("templateSeed").value;
if (seed) Math.random = aleaPRNG(seed);
const currentSeed = byId("templateSeed").value;
const seed = (locked("templateSeed") && currentSeed) || generateSeed();
Math.random = aleaPRNG(seed);
byId("templateSeed").value = seed;
grid.cells.h = createTypedArray({maxValue: 100, length: grid.points.length});
HeightmapGenerator.setGraph(grid);

View file

@ -257,8 +257,8 @@ function testSpeaker() {
}
function generateMapWithSeed() {
if (optionsSeed.value == seed) return tip("The current map already has this seed", false, "error");
regeneratePrompt();
if (optionsSeed.value === seed) return tip("The current map already has this seed", false, "error");
regeneratePrompt({seed: optionsSeed.value});
}
function showSeedHistoryDialog() {
@ -288,7 +288,7 @@ function restoreSeed(id) {
if (locked("template")) unlock("template");
regeneratePrompt();
regeneratePrompt({seed});
}
function restoreDefaultZoomExtent() {