mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
v1.5.8 - update river data on map load
This commit is contained in:
parent
fbec08f982
commit
49b9895b0b
3 changed files with 21 additions and 4 deletions
2
main.js
2
main.js
|
|
@ -2,7 +2,7 @@
|
||||||
// https://github.com/Azgaar/Fantasy-Map-Generator
|
// https://github.com/Azgaar/Fantasy-Map-Generator
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
const version = "1.5"; // generator version
|
const version = "1.59"; // generator version
|
||||||
document.title += " v" + version;
|
document.title += " v" + version;
|
||||||
|
|
||||||
// Switches to disable/enable logging features
|
// Switches to disable/enable logging features
|
||||||
|
|
|
||||||
|
|
@ -389,9 +389,9 @@ const remove = function(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const getBasin = function(r) {
|
const getBasin = function(r) {
|
||||||
const parent = pack.rivers.find(river => river.i === r)?.parent;
|
const parent = pack.rivers.find(river => river.i === r)?.parent;
|
||||||
if (!parent || r === parent) return r;
|
if (!parent || r === parent) return r;
|
||||||
return getBasin(parent);
|
return getBasin(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {generate, resolveDepressions, addMeandering, getPath, specify, getName, getBasin, remove};
|
return {generate, resolveDepressions, addMeandering, getPath, specify, getName, getBasin, remove};
|
||||||
|
|
|
||||||
|
|
@ -1099,6 +1099,23 @@ function parseLoadedData(data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version < 1.59) {
|
||||||
|
// v 1.6 changed rivers data
|
||||||
|
for (const river of pack.rivers) {
|
||||||
|
const el = document.getElementById("river"+river.i);
|
||||||
|
if (el) {
|
||||||
|
el.removeAttribute("data-width");
|
||||||
|
el.removeAttribute("data-increment");
|
||||||
|
river.widthFactor = +this.getAttribute("data-width");
|
||||||
|
river.discharge = pack.cells.fl[river.mouth] || 1;
|
||||||
|
river.width = rn(river.length / 100, 2);
|
||||||
|
river.sourceWidth = .1;
|
||||||
|
} else {
|
||||||
|
Rivers.remove(river.i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
void function checkDataIntegrity() {
|
void function checkDataIntegrity() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue