fix: #1024, regenerate burgs - ignore removed states

This commit is contained in:
Azgaar 2023-12-05 02:24:36 +04:00
parent fec5f421ad
commit da5c0e9493
3 changed files with 5 additions and 5 deletions

View file

@ -8005,7 +8005,7 @@
<script defer src="modules/relief-icons.js"></script> <script defer src="modules/relief-icons.js"></script>
<script defer src="modules/ui/style.js?v=1.95.00"></script> <script defer src="modules/ui/style.js?v=1.95.00"></script>
<script defer src="modules/ui/editors.js?v=1.93.10"></script> <script defer src="modules/ui/editors.js?v=1.93.10"></script>
<script defer src="modules/ui/tools.js?v=1.92.00"></script> <script defer src="modules/ui/tools.js?v=1.95.01"></script>
<script defer src="modules/ui/world-configurator.js?v=1.91.05"></script> <script defer src="modules/ui/world-configurator.js?v=1.91.05"></script>
<script defer src="modules/ui/heightmap-editor.js?v=1.93.00"></script> <script defer src="modules/ui/heightmap-editor.js?v=1.93.00"></script>
<script defer src="modules/ui/provinces-editor.js?v=1.92.00"></script> <script defer src="modules/ui/provinces-editor.js?v=1.92.00"></script>

View file

@ -361,10 +361,10 @@ function regenerateBurgs() {
const score = new Int16Array(cells.s.map(s => s * Math.random())); // cell score for capitals placement const score = new Int16Array(cells.s.map(s => s * Math.random())); // cell score for capitals placement
const sorted = cells.i.filter(i => score[i] > 0 && cells.culture[i]).sort((a, b) => score[b] - score[a]); // filtered and sorted array of indexes const sorted = cells.i.filter(i => score[i] > 0 && cells.culture[i]).sort((a, b) => score[b] - score[a]); // filtered and sorted array of indexes
const existingStatesCount = states.filter(s => s.i && !s.removed).length;
const burgsCount = const burgsCount =
manorsInput.value === "1000" (manorsInput.value === "1000" ? rn(sorted.length / 5 / (grid.points.length / 10000) ** 0.8) : +manorsInput.value) +
? rn(sorted.length / 5 / (grid.points.length / 10000) ** 0.8) + states.length existingStatesCount;
: +manorsInput.value + states.length;
const spacing = (graphWidth + graphHeight) / 150 / (burgsCount ** 0.7 / 66); // base min distance between towns const spacing = (graphWidth + graphHeight) / 150 / (burgsCount ** 0.7 / 66); // base min distance between towns
for (let i = 0; i < sorted.length && burgs.length < burgsCount; i++) { for (let i = 0; i < sorted.length && burgs.length < burgsCount; i++) {

View file

@ -1,7 +1,7 @@
"use strict"; "use strict";
// version and caching control // version and caching control
const version = "1.95.00"; // generator version, update each time const version = "1.95.01"; // generator version, update each time
{ {
document.title += " v" + version; document.title += " v" + version;