fix: enhance population constraints in UI and calculations

This commit is contained in:
Azgaar 2026-01-09 23:21:43 +01:00
parent fa8fd58259
commit 0c26f0831f
4 changed files with 10 additions and 15 deletions

View file

@ -5420,12 +5420,7 @@
<th data-tip="Rendering order: higher values are rendered on top">Order</th>
<th data-tip="Type group name">Name</th>
<th data-tip="Burg preview generator">Preview generator</th>
<th data-tip="Set min population constraint" colspan="2">Population</th>
<th
data-tip="Set population percentile: 0-100, where 90 means the burg must have a population higher than 90% of all burgs"
>
Percentile
</th>
<th data-tip="Set min population constraint" colspan="3">Population</th>
<th data-tip="Select allowed biomes">Biomes</th>
<th data-tip="Select allowed states">States</th>
<th data-tip="Select allowed cultures">Cultures</th>
@ -8496,7 +8491,7 @@
<script src="modules/biomes.js?v=1.99.00"></script>
<script src="modules/names-generator.js?v=1.106.0"></script>
<script src="modules/cultures-generator.js?v=1.106.0"></script>
<script src="modules/burgs-generator.js?v=1.107.0"></script>
<script src="modules/burgs-generator.js?v=1.109.5"></script>
<script src="modules/states-generator.js?v=1.107.0"></script>
<script src="modules/provinces-generator.js?v=1.106.0"></script>
<script src="modules/routes-generator.js?v=1.106.0"></script>
@ -8538,7 +8533,7 @@
<script defer src="modules/ui/rivers-editor.js?v=1.106.0"></script>
<script defer src="modules/ui/rivers-creator.js?v=1.106.0"></script>
<script defer src="modules/ui/relief-editor.js?v=1.99.00"></script>
<script defer src="modules/ui/burg-group-editor.js?v=1.106.0"></script>
<script defer src="modules/ui/burg-group-editor.js?v=1.109.5"></script>
<script defer src="modules/ui/burg-editor.js?v=1.106.6"></script>
<script defer src="modules/ui/units-editor.js?v=1.108.12"></script>
<script defer src="modules/ui/notes-editor.js?v=1.107.3"></script>

View file

@ -399,8 +399,8 @@ window.Burgs = (() => {
const [x2, y2] = cells.p[cells.haven[cell]];
const deg = (Math.atan2(y2 - y1, x2 - x1) * 180) / Math.PI;
if (deg <= 0) return normalize(Math.abs(deg), 0, 180);
return 2 - normalize(deg, 0, 180);
if (deg <= 0) return rn(normalize(Math.abs(deg), 0, 180), 2);
return rn(2 - normalize(deg, 0, 180), 2);
})();
const arableBiomes = river ? [1, 2, 3, 4, 5, 6, 7, 8] : [5, 6, 7, 8];

View file

@ -13,7 +13,7 @@ function editBurgGroups() {
byId("burgGroupsForm").requestSubmit();
},
Add: () => {
byId("burgGroupsBody").innerHTML += createLine({name: "", active: true, preview: null});
byId("burgGroupsBody").insertAdjacentHTML("beforeend", createLine({name: "", active: true, preview: null}));
},
Restore: () => {
options.burgs.groups = Burgs.getDefaultGroups();
@ -69,9 +69,9 @@ function editBurgGroups() {
<option value="watabou-dwelling" ${group.preview === "watabou-dwelling" ? "selected" : ""}>Watabou Dwelling</option>
</select>
</td>
<td data-tip="Set min population constraint"><input type="number" name="min" min="0" step="any" value="${group.min || ''}" /></td>
<td data-tip="Set max population constraint"><input type="number" name="max" min="0" step="any" value="${group.max || ''}" /></td>
<td data-tip="Set population percentile"><input type="number" name="percentile" min="0" max="100" step="any" value="${group.percentile || ''}" /></td>
<td data-tip="Set min population constraint in population points (see the multiplier in Units Editor)"><input type="number" name="min" min="0" step="any" value="${group.min || ''}" /></td>
<td data-tip="Set max population constraint in population points (see the multiplier in Units Editor)"><input type="number" name="max" min="0" step="any" value="${group.max || ''}" /></td>
<td data-tip="Set population percentile: 0-100, where 90 means the burg must have a population higher than 90% of all burgs"><input type="number" name="percentile" min="0" max="100" step="any" value="${group.percentile || ''}" /></td>
<td data-tip="Select allowed biomes">
<input type="hidden" name="biomes" value="${group.biomes || ""}">
<button type="button" name="biomes">${group.biomes ? "some" : "all"}</button>

View file

@ -13,7 +13,7 @@
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
*/
const VERSION = "1.109.4";
const VERSION = "1.109.5";
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
{