+
Elevation:
above sea level
diff --git a/main.js b/main.js
index eb086ba8..c63c13ab 100644
--- a/main.js
+++ b/main.js
@@ -2,7 +2,7 @@
// https://github.com/Azgaar/Fantasy-Map-Generator
"use strict";
-const version = "1.59"; // generator version
+const version = "1.6"; // generator version
document.title += " v" + version;
// Switches to disable/enable logging features
@@ -338,7 +338,7 @@ function applyDefaultBiomesSystem() {
}
function showWelcomeMessage() {
- const post = "Main changes:" //link("https://www.reddit.com/r/FantasyMapGenerator/comments/ft5b41/update_v15/", "Main changes:");
+ const post = "Main changes:" //link("https://www.reddit.com/r/FantasyMapGenerator/comments/ft5b41/update_v16/", "Main changes:");
const changelog = link("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog", "previous version");
const reddit = link("https://www.reddit.com/r/FantasyMapGenerator", "Reddit community");
const discord = link("https://discordapp.com/invite/X7E84HU", "Discord server");
diff --git a/modules/save-and-load.js b/modules/save-and-load.js
index 9a620604..3a75b9e4 100644
--- a/modules/save-and-load.js
+++ b/modules/save-and-load.js
@@ -1100,7 +1100,7 @@ function parseLoadedData(data) {
});
}
- if (version < 1.59) {
+ if (version < 1.6) {
// v 1.6 changed rivers data
for (const river of pack.rivers) {
const el = document.getElementById("river"+river.i);
@@ -1115,8 +1115,22 @@ function parseLoadedData(data) {
Rivers.remove(river.i);
}
}
- }
+ // v 1.6 changed lakes data
+ for (const f of pack.features) {
+ if (f.type !== "lake") continue;
+ if (f.evaporation) continue;
+
+ f.flux = f.flux || f.cells * 3;
+ f.temp = grid.cells.temp[pack.cells.g[f.firstCell]];
+ f.height = f.height || d3.min(pack.cells.c[f.firstCell].map(c => pack.cells.h[c]).filter(h => h >= 20));
+ const height = (f.height - 18) ** heightExponentInput.value;
+ const evaporation = (700 * (f.temp + .006 * height) / 50 + 75) / (80 - f.temp);
+ f.evaporation = rn(evaporation * f.cells);
+ f.name = f.name || Lakes.getName(f);
+ delete f.river;
+ }
+ }
}()
void function checkDataIntegrity() {
diff --git a/modules/ui/heightmap-editor.js b/modules/ui/heightmap-editor.js
index db83a8b4..f599dd64 100644
--- a/modules/ui/heightmap-editor.js
+++ b/modules/ui/heightmap-editor.js
@@ -351,7 +351,6 @@ function editHeightmap() {
if (!b.i || b.removed) continue;
b.cell = findBurgCell(b.x, b.y);
b.feature = pack.cells.f[b.cell];
- //if (b.port) b.port = pack.cells.f[pack.cells.haven[b.cell]]; // water body id
pack.cells.burg[b.cell] = b.i;
if (!b.capital && pack.cells.h[b.cell] < 20) removeBurg(b.i);
@@ -383,7 +382,10 @@ function editHeightmap() {
drawStates();
drawBorders();
- if (changeHeights.checked) Rivers.specify();
+ if (changeHeights.checked) {
+ Rivers.specify();
+ Lakes.generateName();
+ }
// restore zones from grid
zones.selectAll("g").each(function() {
diff --git a/modules/ui/lakes-editor.js b/modules/ui/lakes-editor.js
index 4b5c6701..3f1e4d60 100644
--- a/modules/ui/lakes-editor.js
+++ b/modules/ui/lakes-editor.js
@@ -40,12 +40,32 @@ function editLake() {
}
function updateLakeValues() {
+ const cells = pack.cells;
+
const l = getLake();
document.getElementById("lakeName").value = l.name;
- document.getElementById("lakeGroup").value = l.type;
const unit = areaUnit.value === "square" ? " " + distanceUnitInput.value + "²" : " " + areaUnit.value;
document.getElementById("lakeArea").value = si(l.area * distanceScaleInput.value ** 2) + unit;
+
+ const length = d3.polygonLength(l.vertices.map(v => pack.vertices.p[v]));
+ document.getElementById("lakeShoreLength").value = si(length * distanceScaleInput.value) + " " + distanceUnitInput.value;
+
+ const lakeCells = Array.from(cells.i.filter(i => cells.f[i] === l.i));
+ const heights = lakeCells.map(i => cells.h[i]);
+
+ document.getElementById("lakeElevation").value = getHeight(l.height);
+ document.getElementById("lakeAvarageDepth").value = getHeight(d3.mean(heights), "abs");
+ document.getElementById("lakeMaxDepth").value = getHeight(d3.min(heights), "abs");
+
+ document.getElementById("lakeFlux").value = l.flux;
+ document.getElementById("lakeEvaporation").value = l.evaporation;
+
+ const inlets = l.inlets && l.inlets.map(inlet => pack.rivers.find(river => river.i === inlet)?.name);
+ const outlet = l.outlet ? pack.rivers.find(river => river.i === l.outlet)?.name : "no";
+ document.getElementById("lakeInlets").value = inlets ? inlets.length : "no";
+ document.getElementById("lakeInlets").title = inlets ? inlets.join(", ") : "";
+ document.getElementById("lakeOutlet").value = outlet;
}
function drawLakeVertices() {
@@ -110,6 +130,7 @@ function editLake() {
function changeLakeGroup() {
document.getElementById(this.value).appendChild(elSelected.node());
+ getLake().group = this.value;
}
function toggleNewGroupInput() {
@@ -195,7 +216,7 @@ function editLake() {
function editLakeLegend() {
const id = elSelected.attr("id");
- editNotes(id, id);
+ editNotes(id, getLake().name + " " + lakeGroup.value + " lake");
}
function closeLakesEditor() {
diff --git a/modules/ui/rivers-editor.js b/modules/ui/rivers-editor.js
index b4e4c98f..1a033eec 100644
--- a/modules/ui/rivers-editor.js
+++ b/modules/ui/rivers-editor.js
@@ -204,7 +204,8 @@ function editRiver(id) {
function editRiverLegend() {
const id = elSelected.attr("id");
- editNotes(id, id);
+ const river = getRiver();
+ editNotes(id, river.name + " " + river.type);
}
function toggleRiverCreationMode() {