mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 12:01:23 +01:00
Merge remote-tracking branch 'origin/master' into gui/lock-everything
# Conflicts: # index.html # versioning.js
This commit is contained in:
commit
ae9ba6c077
9 changed files with 39 additions and 27 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue