mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
urbanDensity - save/load
This commit is contained in:
parent
3f58b9f362
commit
cc82d258fa
5 changed files with 9 additions and 6 deletions
|
|
@ -3215,10 +3215,10 @@
|
||||||
<input id="urbanizationInput" data-stored="urbanization" type="number" min=.01 max=5 step=.01 value=1 >
|
<input id="urbanizationInput" data-stored="urbanization" type="number" min=.01 max=5 step=.01 value=1 >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div data-tip="Set urban density: average population per building (note, individual cities will vary)">
|
<div data-tip="Set urban density: average population per building in Medieval Fantasy City Generator">
|
||||||
<div>Urban density:</div>
|
<div>Urban density:</div>
|
||||||
<input id="urbanDensityOutput" data-stored="urbanDensity" type="range" min=2 max=20 step=.5 value=7 >
|
<input id="urbanDensityOutput" data-stored="urbanDensity" type="range" min=2 max=20 step=.5 value=10 >
|
||||||
<input id="urbanDensityInput" data-stored="urbanDensity" type="number" min=2 max=20 step=.5 value=7 >
|
<input id="urbanDensityInput" data-stored="urbanDensity" type="number" min=2 max=20 step=.5 value=10 >
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,7 @@ function parseLoadedData(data) {
|
||||||
if (settings[21]) hideLabels.checked = +settings[21];
|
if (settings[21]) hideLabels.checked = +settings[21];
|
||||||
if (settings[22]) stylePreset.value = settings[22];
|
if (settings[22]) stylePreset.value = settings[22];
|
||||||
if (settings[23]) rescaleLabels.checked = +settings[23];
|
if (settings[23]) rescaleLabels.checked = +settings[23];
|
||||||
|
if (settings[24]) urbanDensity = urbanDensity.value = urbanDensityOutput.value = +settings[24];
|
||||||
})();
|
})();
|
||||||
|
|
||||||
void (function parseConfiguration() {
|
void (function parseConfiguration() {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ function getMapData() {
|
||||||
mapName.value,
|
mapName.value,
|
||||||
+hideLabels.checked,
|
+hideLabels.checked,
|
||||||
stylePreset.value,
|
stylePreset.value,
|
||||||
+rescaleLabels.checked
|
+rescaleLabels.checked,
|
||||||
|
urbanDensity
|
||||||
].join("|");
|
].join("|");
|
||||||
const coords = JSON.stringify(mapCoordinates);
|
const coords = JSON.stringify(mapCoordinates);
|
||||||
const biomes = [biomesData.color, biomesData.habitability, biomesData.name].join("|");
|
const biomes = [biomesData.color, biomesData.habitability, biomesData.name].join("|");
|
||||||
|
|
|
||||||
|
|
@ -416,7 +416,8 @@ function editBurg(id) {
|
||||||
const {cells} = pack;
|
const {cells} = pack;
|
||||||
const {name, population, cell} = burg;
|
const {name, population, cell} = burg;
|
||||||
const burgSeed = getBurgSeed(burg);
|
const burgSeed = getBurgSeed(burg);
|
||||||
const size = Math.max(Math.min(Math.ceil(2.13*Math.pow(population * populationRate/urbanDensity,0.385)), 100), 6);
|
const sizeRaw = 2.13 * Math.pow((population * populationRate) / urbanDensity, 0.385);
|
||||||
|
const size = minmax(Math.ceil(sizeRaw), 6, 100);
|
||||||
const people = rn(population * populationRate * urbanization);
|
const people = rn(population * populationRate * urbanization);
|
||||||
|
|
||||||
const hub = +cells.road[cell] > 50;
|
const hub = +cells.road[cell] > 50;
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ function editUnits() {
|
||||||
urbanDensity = urbanDensityOutput.value = urbanDensityInput.value = 10;
|
urbanDensity = urbanDensityOutput.value = urbanDensityInput.value = 10;
|
||||||
localStorage.removeItem("populationRate");
|
localStorage.removeItem("populationRate");
|
||||||
localStorage.removeItem("urbanization");
|
localStorage.removeItem("urbanization");
|
||||||
localStorage.removeItem("urbanDensity")
|
localStorage.removeItem("urbanDensity");
|
||||||
}
|
}
|
||||||
|
|
||||||
function addRuler() {
|
function addRuler() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue