diff --git a/index.html b/index.html index a143b30c..b91c5d21 100644 --- a/index.html +++ b/index.html @@ -3173,6 +3173,12 @@ + +
+
Urban density:
+ + +
diff --git a/main.js b/main.js index 25ebb60e..02a797fd 100644 --- a/main.js +++ b/main.js @@ -153,6 +153,7 @@ options.winds = [225, 45, 225, 315, 135, 315]; // default wind directions let populationRate = +document.getElementById("populationRateInput").value; let urbanization = +document.getElementById("urbanizationInput").value; +let urbanDensity = +document.getElementById("urbanDensityInput").value; applyStoredOptions(); let graphWidth = +mapWidthInput.value, diff --git a/modules/ui/burg-editor.js b/modules/ui/burg-editor.js index 433a9a9d..ea7554cb 100644 --- a/modules/ui/burg-editor.js +++ b/modules/ui/burg-editor.js @@ -426,7 +426,7 @@ function editBurg(id) { } const cells = pack.cells; const name = elSelected.text(); - const size = Math.max(Math.min(rn(burg.population), 100), 6); // to be removed once change on MFDC is done + const size = Math.ceil(2.13*Math.pow(burg.population * populationRate / urbanDensity,0.385));//Math.max(Math.min(rn(burg.population), 100), 6); // to be removed once change on MFDC is done const population = rn(burg.population * populationRate * urbanization); const s = burg.MFCG || defSeed; diff --git a/modules/ui/units-editor.js b/modules/ui/units-editor.js index 54571191..57b9a602 100644 --- a/modules/ui/units-editor.js +++ b/modules/ui/units-editor.js @@ -31,6 +31,8 @@ function editUnits() { document.getElementById("populationRateInput").addEventListener("change", changePopulationRate); document.getElementById("urbanizationOutput").addEventListener("input", changeUrbanizationRate); document.getElementById("urbanizationInput").addEventListener("change", changeUrbanizationRate); + document.getElementById("urbanDensityOutput").addEventListener("input", changeUrbanDensity); + document.getElementById("urbanDensityInput").addEventListener("change", changeUrbanDensity); document.getElementById("addLinearRuler").addEventListener("click", addRuler); document.getElementById("addOpisometer").addEventListener("click", toggleOpisometerMode); @@ -93,6 +95,10 @@ function editUnits() { urbanization = +this.value; } + function changeUrbanDensity() { + urbanDensity = +this.value; + } + function restoreDefaultUnits() { // distanceScale document.getElementById("distanceScaleOutput").value = 3; @@ -135,8 +141,10 @@ function editUnits() { // population populationRate = populationRateOutput.value = populationRateInput.value = 1000; urbanization = urbanizationOutput.value = urbanizationInput.value = 1; + urbanDensity = urbanDensityOutput.value = urbanDensityInput.value = 7; localStorage.removeItem("populationRate"); localStorage.removeItem("urbanization"); + localStorage.removeItem("urbanDensity") } function addRuler() {