diff --git a/index.html b/index.html
index d012cd31..deff88bc 100644
--- a/index.html
+++ b/index.html
@@ -8004,7 +8004,7 @@
-
+
@@ -8042,13 +8042,13 @@
-
-
+
+
-
+
diff --git a/modules/dynamic/editors/cultures-editor.js b/modules/dynamic/editors/cultures-editor.js
index 053a177e..fac79955 100644
--- a/modules/dynamic/editors/cultures-editor.js
+++ b/modules/dynamic/editors/cultures-editor.js
@@ -341,10 +341,7 @@ function cultureChangeColor() {
const callback = newFill => {
$el.fill = newFill;
pack.cultures[cultureId].color = newFill;
- cults
- .select("#culture" + cultureId)
- .attr("fill", newFill)
- .attr("stroke", newFill);
+ cults.select("#culture" + cultureId).attr("fill", newFill);
debug.select("#cultureCenter" + cultureId).attr("fill", newFill);
};
diff --git a/modules/ui/editors.js b/modules/ui/editors.js
index f89cc9e0..d42e4a28 100644
--- a/modules/ui/editors.js
+++ b/modules/ui/editors.js
@@ -1182,7 +1182,7 @@ async function editStates() {
async function editCultures() {
if (customization) return;
- const Editor = await import("../dynamic/editors/cultures-editor.js?v=1.91.00");
+ const Editor = await import("../dynamic/editors/cultures-editor.js?v=1.95.04");
Editor.open();
}
diff --git a/modules/ui/namesbase-editor.js b/modules/ui/namesbase-editor.js
index 0dba088a..edf472eb 100644
--- a/modules/ui/namesbase-editor.js
+++ b/modules/ui/namesbase-editor.js
@@ -244,11 +244,13 @@ function editNamesbase() {
Names.clearChains();
if (override) nameBases = [];
+ const unsafe = new RegExp(/[|/]/, "g");
data.forEach(base => {
- const [name, min, max, d, m, names] = base.split("|");
- const secureNames = names.replace(/[/|]/g, "");
- nameBases.push({name, min, max, d, m, b: secureNames});
+ const [rawName, min, max, d, m, rawNames] = base.split("|");
+ const name = rawName.replace(unsafe, "");
+ const names = rawNames.replace(unsafe, "");
+ nameBases.push({name, min, max, d, m, b: names});
});
createBasesList();
diff --git a/modules/ui/tools.js b/modules/ui/tools.js
index e1d554da..5d9d0d40 100644
--- a/modules/ui/tools.js
+++ b/modules/ui/tools.js
@@ -361,10 +361,10 @@ function regenerateBurgs() {
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 existingStatesCount = states.filter(s => s.i && !s.removed).length;
const burgsCount =
- manorsInput.value === "1000"
- ? rn(sorted.length / 5 / (grid.points.length / 10000) ** 0.8) + states.length
- : +manorsInput.value + states.length;
+ (manorsInput.value === "1000" ? rn(sorted.length / 5 / (grid.points.length / 10000) ** 0.8) : +manorsInput.value) +
+ existingStatesCount;
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++) {
diff --git a/utils/polyfills.js b/utils/polyfills.js
index 667d81ab..ffc10f74 100644
--- a/utils/polyfills.js
+++ b/utils/polyfills.js
@@ -15,6 +15,15 @@ if (Array.prototype.flat === undefined) {
};
}
+// at
+if (Array.prototype.at === undefined) {
+ Array.prototype.at = function (index) {
+ if (index < 0) index += this.length;
+ if (index < 0 || index >= this.length) return undefined;
+ return this[index];
+ };
+}
+
// readable stream iterator: https://bugs.chromium.org/p/chromium/issues/detail?id=929585#c10
if (ReadableStream.prototype[Symbol.asyncIterator] === undefined) {
ReadableStream.prototype[Symbol.asyncIterator] = async function* () {