diff --git a/index.html b/index.html
index 1fb860ab..baa5562b 100644
--- a/index.html
+++ b/index.html
@@ -7846,7 +7846,7 @@
-
+
@@ -7863,11 +7863,11 @@
-
+
-
+
diff --git a/main.js b/main.js
index 69323e92..5cf0edc3 100644
--- a/main.js
+++ b/main.js
@@ -191,7 +191,6 @@ let populationRate = +document.getElementById("populationRateInput").value;
let distanceScale = +document.getElementById("distanceScaleInput").value;
let urbanization = +document.getElementById("urbanizationInput").value;
let urbanDensity = +document.getElementById("urbanDensityInput").value;
-let statesNeutral = 1; // statesEditor growth parameter
applyStoredOptions();
diff --git a/modules/burgs-and-states.js b/modules/burgs-and-states.js
index e9069e83..f0b13a05 100644
--- a/modules/burgs-and-states.js
+++ b/modules/burgs-and-states.js
@@ -367,18 +367,28 @@ window.BurgsAndStates = (function () {
cells.state = cells.state || new Uint16Array(cells.i.length);
const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p});
const cost = [];
- const neutral = (cells.i.length / 5000) * 2500 * neutralInput.value * statesNeutral; // limit cost for state growth
- states
- .filter(s => s.i && !s.removed)
- .forEach(s => {
- const capitalCell = burgs[s.capital].cell;
- cells.state[capitalCell] = s.i;
- const cultureCenter = cultures[s.culture].center;
- const b = cells.biome[cultureCenter]; // state native biome
- queue.queue({e: s.center, p: 0, s: s.i, b});
- cost[s.center] = 1;
- });
+ const globalNeutralRate = byId("neutralInput")?.value || 1;
+ const statesNeutralRate = byId("statesNeutral")?.value || 1;
+ const neutral = (cells.i.length / 2) * globalNeutralRate * statesNeutralRate; // limit cost for state growth
+
+ // remove state from all cells except of locked
+ for (const cellId of cells.i) {
+ const state = states[cells.state[cellId]];
+ if (state.lock) continue;
+ cells.state[cellId] = 0;
+ }
+
+ for (const state of states) {
+ if (!state.i || state.removed) continue;
+
+ const capitalCell = burgs[state.capital].cell;
+ cells.state[capitalCell] = state.i;
+ const cultureCenter = cultures[state.culture].center;
+ const b = cells.biome[cultureCenter]; // state native biome
+ queue.queue({e: state.center, p: 0, s: state.i, b});
+ cost[state.center] = 1;
+ }
while (queue.length) {
const next = queue.dequeue();
diff --git a/modules/dynamic/editors/states-editor.js b/modules/dynamic/editors/states-editor.js
index 87592706..41241340 100644
--- a/modules/dynamic/editors/states-editor.js
+++ b/modules/dynamic/editors/states-editor.js
@@ -883,7 +883,6 @@ function changeStatesGrowthRate() {
const growthRate = +this.value;
byId("statesNeutral").value = growthRate;
byId("statesNeutralNumber").value = growthRate;
- statesNeutral = growthRate;
tip("Growth rate: " + growthRate);
recalculateStates(false);
}
diff --git a/modules/ui/editors.js b/modules/ui/editors.js
index 2d40c916..54ab8300 100644
--- a/modules/ui/editors.js
+++ b/modules/ui/editors.js
@@ -1176,7 +1176,7 @@ function refreshAllEditors() {
// dynamically loaded editors
async function editStates() {
if (customization) return;
- const Editor = await import("../dynamic/editors/states-editor.js?v=1.89.02");
+ const Editor = await import("../dynamic/editors/states-editor.js?v=1.89.05");
Editor.open();
}
diff --git a/versioning.js b/versioning.js
index 734e3886..ff5c3ef3 100644
--- a/versioning.js
+++ b/versioning.js
@@ -1,7 +1,7 @@
"use strict";
// version and caching control
-const version = "1.89.04"; // generator version, update each time
+const version = "1.89.05"; // generator version, update each time
{
document.title += " v" + version;