From cc998e7773271a09721fee4937c481ad0465b172 Mon Sep 17 00:00:00 2001 From: A C James Date: Wed, 1 Feb 2023 16:37:00 -0700 Subject: [PATCH 01/17] preparatory bugfixes --- modules/dynamic/editors/religions-editor.js | 4 ++-- modules/religions-generator.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index 4cf1903f..048a2451 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -3,10 +3,10 @@ addListeners(); export function open() { closeDialogs("#religionsEditor, .stable"); - if (!layerIsOn("toggleReligions")) toggleCultures(); + if (!layerIsOn("toggleReligions")) toggleReligions(); if (layerIsOn("toggleStates")) toggleStates(); if (layerIsOn("toggleBiomes")) toggleBiomes(); - if (layerIsOn("toggleCultures")) toggleReligions(); + if (layerIsOn("toggleCultures")) toggleCultures(); if (layerIsOn("toggleProvinces")) toggleProvinces(); refreshReligionsEditor(); diff --git a/modules/religions-generator.js b/modules/religions-generator.js index 4d06d327..0cf5158a 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -700,7 +700,7 @@ window.Religions = (function () { form: formName, deity, expansion, - expansionism: 0, + expansionism: 0.01, center, cells: 0, area: 0, From 672e82cc0879a667dac45c55f670f33b03560355 Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Wed, 1 Feb 2023 18:00:51 -0700 Subject: [PATCH 02/17] restructure religion generator for extensibility --- modules/dynamic/editors/religions-editor.js | 13 ++++ modules/religions-generator.js | 66 +++++++++++++-------- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index 048a2451..3f1d09ce 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -773,3 +773,16 @@ function updateLockStatus() { classList.toggle("icon-lock-open"); classList.toggle("icon-lock"); } + +function recalculateReligions(must) { + if (!must && !religionsAutoChange.checked) return; + + Religions.resetUnlockedReligions(); + Religions.expandReligions(); + Religions.expandHeresies(); + Religions.checkReligionCentres(); + + drawReligions(); + refreshReligionsEditor(); + drawReligionCenters(); +} diff --git a/modules/religions-generator.js b/modules/religions-generator.js index 0cf5158a..cc8d55bb 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -438,6 +438,8 @@ window.Religions = (function () { } } + cells.religion = religionIds; + // generate organized religions for (let i = 0; religions.length < count && i < 1000; i++) { let center = sorted[biased(0, sorted.length - 1, 5)]; // religion center @@ -520,6 +522,8 @@ window.Religions = (function () { religionsTree.add([x, y]); } + pack.religions = religions; + expandReligions(); // generate heresies @@ -540,8 +544,8 @@ window.Religions = (function () { const name = getCultName("Heresy", center); const expansionism = gauss(1.2, 0.5, 0, 5); const color = getMixedColor(r.color, 0.4, 0.2); // "url(#hatch6)"; - religions.push({ - i: religions.length, + pack.religions.push({ + i: pack.religions.length, name, color, culture, @@ -559,19 +563,20 @@ window.Religions = (function () { expandHeresies(); - checkCenters(); - - cells.religion = religionIds; - pack.religions = religions; + checkReligionCenters(); TIME && console.timeEnd("generateReligions"); + }; // growth algorithm to assign cells to religions - function expandReligions() { + const expandReligions = function() { const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p}); const cost = []; + const religionIds = pack.cells.religion; + const cells = pack.cells; - religions + + pack.religions .filter(r => !r.lock && (r.type === "Organized" || r.type === "Cult")) .forEach(r => { religionIds[r.center] = r.i; @@ -584,12 +589,12 @@ window.Religions = (function () { while (queue.length) { const {e, p, r, c, s} = queue.dequeue(); - const expansion = religions[r].expansion; + const expansion = pack.religions[r].expansion; cells.c[e].forEach(nextCell => { if (expansion === "culture" && c !== cells.culture[nextCell]) return; if (expansion === "state" && s !== cells.state[nextCell]) return; - if (religions[religionIds[nextCell]]?.lock) return; + if (pack.religions[religionIds[nextCell]]?.lock) return; const cultureCost = c !== cells.culture[nextCell] ? 10 : 0; const stateCost = s !== cells.state[nextCell] ? 10 : 0; @@ -599,7 +604,7 @@ window.Religions = (function () { const waterCost = cells.h[nextCell] < 20 ? (cells.road[nextCell] ? 50 : 1000) : 0; const totalCost = p + - (cultureCost + stateCost + biomeCost + populationCost + heightCost + waterCost) / religions[r].expansionism; + (cultureCost + stateCost + biomeCost + populationCost + heightCost + waterCost) / pack.religions[r].expansionism; if (totalCost > neutral) return; if (!cost[nextCell] || totalCost < cost[nextCell]) { @@ -609,14 +614,16 @@ window.Religions = (function () { } }); } - } + }; // growth algorithm to assign cells to heresies - function expandHeresies() { + const expandHeresies = function() { const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p}); const cost = []; + const religionIds = pack.cells.religion; + const cells = pack.cells; - religions + pack.religions .filter(r => !r.lock && r.type === "Heresy") .forEach(r => { const b = religionIds[r.center]; // "base" religion id @@ -631,13 +638,13 @@ window.Religions = (function () { const {e, p, r, b} = queue.dequeue(); cells.c[e].forEach(nextCell => { - if (religions[religionIds[nextCell]]?.lock) return; + if (pack.religions[religionIds[nextCell]]?.lock) return; const religionCost = religionIds[nextCell] === b ? 0 : 2000; const biomeCost = cells.road[nextCell] ? 0 : biomesData.cost[cells.biome[nextCell]]; const heightCost = Math.max(cells.h[nextCell], 20) - 20; const waterCost = cells.h[nextCell] < 20 ? (cells.road[nextCell] ? 50 : 1000) : 0; const totalCost = - p + (religionCost + biomeCost + heightCost + waterCost) / Math.max(religions[r].expansionism, 0.1); + p + (religionCost + biomeCost + heightCost + waterCost) / Math.max(pack.religions[r].expansionism, 0.1); if (totalCost > neutral) return; @@ -648,21 +655,20 @@ window.Religions = (function () { } }); } - } + }; - function checkCenters() { - const codes = religions.map(r => r.code); - religions.forEach(r => { + const checkReligionCenters = function() { + const codes = pack.religions.map(r => r.code); + pack.religions.forEach(r => { if (!r.i) return; r.code = abbreviate(r.name, codes); // move religion center if it's not within religion area after expansion - if (religionIds[r.center] === r.i) return; // in area - const firstCell = cells.i.find(i => religionIds[i] === r.i); + if (pack.cells.religion[r.center] === r.i) return; // in area + const firstCell = pack.cells.i.find(i => pack.cells.religion[i] === r.i); if (firstCell) r.center = firstCell; // move center, othervise it's an extinct religion }); - } - }; + }; const add = function (center) { const {cells, religions} = pack; @@ -799,5 +805,15 @@ window.Religions = (function () { return type() + " of the " + generateMeaning(); } - return {generate, add, getDeityName, updateCultures}; + const resetUnlockedReligions = function() { + const religion = pack.cells.religion; + const culture = pack.cells.culture; + for(const i of pack.cells.i){ + if( culture[i] && !pack.religions[religion[i]]?.lock ){ + religion[i] = culture[i]; + } + } + }; + + return {generate, expandReligions, expandHeresies, checkReligionCentres, add, getDeityName, updateCultures, resetUnlockedReligions}; })(); From 2976480cfc022657c9eb631f2ebc3ed44adf5441 Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Tue, 7 Feb 2023 22:12:19 -0700 Subject: [PATCH 03/17] Add culture-like update functions and UI --- modules/dynamic/editors/religions-editor.js | 60 +++++++++++++++++++-- modules/religions-generator.js | 10 +++- 2 files changed, 65 insertions(+), 5 deletions(-) diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index 3f1d09ce..917db90f 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -23,13 +23,15 @@ export function open() { function insertEditorHtml() { const editorHtml = /* html */ `
-
+
Religion 
Type 
Form 
Supreme Deity 
Area 
Believers 
+
Limits 
+
Expansion 
@@ -88,6 +90,11 @@ function insertEditorHtml() {
+ + + + +
`; @@ -109,6 +116,7 @@ function addListeners() { byId("religionsManuallyCancel").on("click", () => exitReligionsManualAssignment()); byId("religionsAdd").on("click", enterAddReligionMode); byId("religionsExport").on("click", downloadReligionsCsv); + byId("religionsRecalculate").on("click", () => recalculateReligions(true)); } function refreshReligionsEditor() { @@ -166,6 +174,7 @@ function religionsEditorAddLines() { data-type="" data-form="" data-deity="" + data-expansion="" data-expansionism="" > @@ -181,6 +190,11 @@ function religionsEditorAddLines() {
${si(area) + unit}
${si(population)}
+ + + `; continue; } @@ -195,6 +209,7 @@ function religionsEditorAddLines() { data-type="${r.type}" data-form="${r.form}" data-deity="${r.deity || ""}" + data-expansion="${r.expansion}" data-expansionism="${r.expansionism}" > @@ -212,6 +227,19 @@ function religionsEditorAddLines() {
${si(area) + unit}
${si(population)}
+ + + input.religionDeity").forEach(el => el.on("input", religionChangeDeity)); $body.querySelectorAll("div > span.icon-arrows-cw").forEach(el => el.on("click", regenerateDeity)); $body.querySelectorAll("div > div.religionPopulation").forEach(el => el.on("click", changePopulation)); + $body.querySelectorAll("div > select.religionLimit").forEach(el => el.on("change", religionChangeLimit)); + $body.querySelectorAll("div > input.religionExpan").forEach(el => el.on("change", religionChangeExpansionism)); $body.querySelectorAll("div > span.icon-trash-empty").forEach(el => el.on("click", religionRemovePrompt)); $body.querySelectorAll("div > span.icon-lock").forEach($el => $el.on("click", updateLockStatus)); $body.querySelectorAll("div > span.icon-lock-open").forEach($el => $el.on("click", updateLockStatus)); @@ -264,6 +294,13 @@ function getTypeOptions(type) { return options; } +function getLimitOptions(type) { + let options = ""; + const types = ["global", "state", "culture"]; + types.forEach(t => (options += ``)); + return options; +} + const religionHighlightOn = debounce(event => { const religionId = Number(event.id || event.target.dataset.id); const $el = $body.querySelector(`div[data-id='${religionId}']`); @@ -434,6 +471,20 @@ function changePopulation() { } } +function religionChangeLimit() { + const religion = +this.parentNode.dataset.id; + this.parentNode.dataset.expansion = this.value; + pack.religions[religion].expansion = this.value; + recalculateReligions(); +} + +function religionChangeExpansionism() { + const religion = +this.parentNode.dataset.id; + this.parentNode.dataset.expansionism = this.value; + pack.religions[religion].expansionism = +this.value; + recalculateReligions(); +} + function religionRemovePrompt() { if (customization) return; @@ -507,6 +558,7 @@ function religionCenterDrag() { const cell = findCell(x, y); if (pack.cells.h[cell] < 20) return; // ignore dragging on water pack.religions[religionId].center = cell; + recalculateReligions(); }); } @@ -740,15 +792,15 @@ function addReligion() { function downloadReligionsCsv() { const unit = getAreaUnit("2"); - const headers = `Id,Name,Color,Type,Form,Supreme Deity,Area ${unit},Believers,Origins`; + const headers = `Id,Name,Color,Type,Form,Supreme Deity,Area ${unit},Believers,Origins,Limit,Expansionism`; const lines = Array.from($body.querySelectorAll(":scope > div")); const data = lines.map($line => { - const {id, name, color, type, form, deity, area, population} = $line.dataset; + const {id, name, color, type, form, deity, area, population, expansion, expansionism} = $line.dataset; const deityText = '"' + deity + '"'; const {origins} = pack.religions[+id]; const originList = (origins || []).filter(origin => origin).map(origin => pack.religions[origin].name); const originText = '"' + originList.join(", ") + '"'; - return [id, name, color, type, form, deityText, area, population, originText].join(","); + return [id, name, color, type, form, deityText, area, population, originText, expansion, expansionism].join(","); }); const csvData = [headers].concat(data).join("\n"); diff --git a/modules/religions-generator.js b/modules/religions-generator.js index cc8d55bb..38e57546 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -808,8 +808,16 @@ window.Religions = (function () { const resetUnlockedReligions = function() { const religion = pack.cells.religion; const culture = pack.cells.culture; + // ignore cultures added since last folk generation. Known Issue + let knownFolk = 1; + for(const j = 1; j++; j Date: Tue, 7 Feb 2023 23:16:04 -0700 Subject: [PATCH 04/17] Syntax / Typo --- modules/dynamic/editors/religions-editor.js | 2 +- modules/religions-generator.js | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index 917db90f..419b191e 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -832,7 +832,7 @@ function recalculateReligions(must) { Religions.resetUnlockedReligions(); Religions.expandReligions(); Religions.expandHeresies(); - Religions.checkReligionCentres(); + Religions.checkReligionCenters(); drawReligions(); refreshReligionsEditor(); diff --git a/modules/religions-generator.js b/modules/religions-generator.js index 38e57546..6d73c34c 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -569,13 +569,12 @@ window.Religions = (function () { }; // growth algorithm to assign cells to religions - const expandReligions = function() { + function expandReligions() { const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p}); const cost = []; const religionIds = pack.cells.religion; const cells = pack.cells; - pack.religions .filter(r => !r.lock && (r.type === "Organized" || r.type === "Cult")) .forEach(r => { @@ -614,10 +613,10 @@ window.Religions = (function () { } }); } - }; + } // growth algorithm to assign cells to heresies - const expandHeresies = function() { + function expandHeresies() { const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p}); const cost = []; const religionIds = pack.cells.religion; @@ -655,9 +654,9 @@ window.Religions = (function () { } }); } - }; + } - const checkReligionCenters = function() { + function checkReligionCenters() { const codes = pack.religions.map(r => r.code); pack.religions.forEach(r => { if (!r.i) return; @@ -668,7 +667,7 @@ window.Religions = (function () { const firstCell = pack.cells.i.find(i => pack.cells.religion[i] === r.i); if (firstCell) r.center = firstCell; // move center, othervise it's an extinct religion }); - }; + } const add = function (center) { const {cells, religions} = pack; @@ -810,7 +809,7 @@ window.Religions = (function () { const culture = pack.cells.culture; // ignore cultures added since last folk generation. Known Issue let knownFolk = 1; - for(const j = 1; j++; j Date: Tue, 7 Feb 2023 23:47:43 -0700 Subject: [PATCH 05/17] PR Versioning --- index.html | 4 ++-- modules/ui/editors.js | 2 +- versioning.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 1fb860ab..3d7f4b33 100644 --- a/index.html +++ b/index.html @@ -7848,7 +7848,7 @@ - + @@ -7867,7 +7867,7 @@ - + diff --git a/modules/ui/editors.js b/modules/ui/editors.js index 2d40c916..2fb4db07 100644 --- a/modules/ui/editors.js +++ b/modules/ui/editors.js @@ -1188,6 +1188,6 @@ async function editCultures() { async function editReligions() { if (customization) return; - const Editor = await import("../dynamic/editors/religions-editor.js?v=1.88.06"); + const Editor = await import("../dynamic/editors/religions-editor.js?v=1.90.00"); Editor.open(); } diff --git a/versioning.js b/versioning.js index 734e3886..5906ebc9 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.90.00"; // generator version, update each time { document.title += " v" + version; @@ -28,6 +28,7 @@ const version = "1.89.04"; // generator version, update each time
    Latest changes: +
  • Religions update by center drag expansionism value
  • Lock states, provinces, cultures, and religions from regeneration
  • Heightmap brushes: linear edit option
  • Data Charts screen
  • From 05a45fca86c10c959a8b3665480911d5bc18a8c3 Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Mon, 20 Feb 2023 16:37:05 -0700 Subject: [PATCH 06/17] Relig Editor UI: hide on brush, limit -> potential --- modules/dynamic/editors/religions-editor.js | 32 ++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index 419b191e..d39c9715 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -30,7 +30,7 @@ function insertEditorHtml() {
    Supreme Deity 
    Area 
    Believers 
    -
    Limits 
    +
    Potential 
    Expansion 
    @@ -91,7 +91,7 @@ function insertEditorHtml() { - + @@ -190,8 +190,8 @@ function religionsEditorAddLines() {
    ${si(area) + unit}
    ${si(population)}
    - + ${getExtentOptions(r.expansion)} @@ -227,13 +227,19 @@ function religionsEditorAddLines() {
    ${si(area) + unit}
    ${si(population)}
    - - + ${r.type == "Folk" ? + ` + "culture" + ` + : + `` + } + (options += ``)); @@ -636,7 +642,7 @@ function enterReligionsManualAssignent() { if (!layerIsOn("toggleReligions")) toggleReligions(); customization = 7; relig.append("g").attr("id", "temp"); - document.querySelectorAll("#religionsBottom > button").forEach(el => (el.style.display = "none")); + document.querySelectorAll("#religionsBottom > *").forEach(el => (el.style.display = "none")); byId("religionsManuallyButtons").style.display = "inline-block"; debug.select("#religionCenters").style("display", "none"); @@ -738,7 +744,7 @@ function exitReligionsManualAssignment(close) { customization = 0; relig.select("#temp").remove(); removeCircle(); - document.querySelectorAll("#religionsBottom > button").forEach(el => (el.style.display = "inline-block")); + document.querySelectorAll("#religionsBottom > *").forEach(el => (el.style.display = "inline-block")); byId("religionsManuallyButtons").style.display = "none"; byId("religionsEditor") @@ -792,7 +798,7 @@ function addReligion() { function downloadReligionsCsv() { const unit = getAreaUnit("2"); - const headers = `Id,Name,Color,Type,Form,Supreme Deity,Area ${unit},Believers,Origins,Limit,Expansionism`; + const headers = `Id,Name,Color,Type,Form,Supreme Deity,Area ${unit},Believers,Origins,Potential,Expansionism`; const lines = Array.from($body.querySelectorAll(":scope > div")); const data = lines.map($line => { const {id, name, color, type, form, deity, area, population, expansion, expansionism} = $line.dataset; From 6d9c8df6512ad5f3bbc65268cfe1b26796ada807 Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Mon, 20 Feb 2023 18:17:54 -0700 Subject: [PATCH 07/17] add / remove Culture creates / removes Folk religion --- modules/dynamic/editors/cultures-editor.js | 16 +++++- modules/religions-generator.js | 67 ++++++++++++++++++---- versioning.js | 3 +- 3 files changed, 71 insertions(+), 15 deletions(-) diff --git a/modules/dynamic/editors/cultures-editor.js b/modules/dynamic/editors/cultures-editor.js index 3f8018d6..ac323573 100644 --- a/modules/dynamic/editors/cultures-editor.js +++ b/modules/dynamic/editors/cultures-editor.js @@ -519,10 +519,11 @@ function cultureRegenerateBurgs() { } function removeCulture(cultureId) { + // and the Folk religion cults.select("#culture" + cultureId).remove(); debug.select("#cultureCenter" + cultureId).remove(); - const {burgs, states, cells, cultures} = pack; + const {burgs, states, cells, cultures, religions} = pack; burgs.filter(b => b.culture == cultureId).forEach(b => (b.culture = 0)); states.forEach(s => { @@ -531,7 +532,11 @@ function removeCulture(cultureId) { cells.culture.forEach((c, i) => { if (c === cultureId) cells.culture[i] = 0; }); + cells.religion.forEach((r, i) => { + if (r === cultureId) cells.religion[i] = 0; + }) cultures[cultureId].removed = true; + religions[cultureId].removed = true; cultures .filter(c => c.i && !c.removed) @@ -539,6 +544,12 @@ function removeCulture(cultureId) { c.origins = c.origins.filter(origin => origin !== cultureId); if (!c.origins.length) c.origins = [0]; }); + religions + .filter(r => r.i && !r.removed) + .forEach(r => { + r.origins = r.origins.filter(origin => origin !== cultureId); + if (!r.origins.length) r.origins = [0]; + }); refreshCulturesEditor(); } @@ -548,7 +559,7 @@ function cultureRemovePrompt() { const cultureId = +this.parentNode.dataset.id; confirmationDialog({ title: "Remove culture", - message: "Are you sure you want to remove the culture?
    This action cannot be reverted", + message: "Are you sure you want to remove the culture?
    The linked folk religion will also be removed.
    This action cannot be reverted", confirm: "Remove", onConfirm: () => removeCulture(cultureId) }); @@ -823,6 +834,7 @@ function addCulture() { if (d3.event.shiftKey === false) exitAddCultureMode(); Cultures.add(center); + Religions.addFolk(center); drawCultureCenters(); culturesEditorAddLines(); diff --git a/modules/religions-generator.js b/modules/religions-generator.js index 6d73c34c..fa36d8a6 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -717,6 +717,57 @@ window.Religions = (function () { cells.religion[center] = i; }; + const addFolk = function (center) { + const {cultures, religions, cells} = pack; + + const c = cultures.find(c => !c.removed && c.center === center); + const color = getMixedColor(c.color, 0.1, 0); + const form = rw(forms.Folk); + const deity = form === "Animism" ? null : getDeityName(c.i); + const name = c.name + " " + rw(types[form]); + const code = abbreviate(name); + const newFolk = { + i: c.i, + name, + color, + culture: c.i, + type: "Folk", + form, + deity, + center: center, + cells: 0, + area: 0, + rural: 0, + urban: 0, + origins: [0], + code + }; + + if(religions[c.i]){ + let rCargo = religions[c.i]; + if(rCargo.type === "Folk") return; + const newId = religions.length; + rCargo.i = newId; + for(const i of cells.i) { + if(cells.religion[i] = c.i) { + cells.religion[i] = newId; + } + } + religions.forEach(r => { + for(let j = 0; j < r.origins.length; j++) { + if(r.origins[j] === c.i) { + r.origins[j] === newid; + return; + } + } + }); + religions.push(rCargo); + religions[c.i] = newFolk; + } else { + religions.push(newFolk); + } + }; + function updateCultures() { TIME && console.time("updateCulturesForReligions"); pack.religions = pack.religions.map((religion, index) => { @@ -805,22 +856,14 @@ window.Religions = (function () { } const resetUnlockedReligions = function() { - const religion = pack.cells.religion; - const culture = pack.cells.culture; - // ignore cultures added since last folk generation. Known Issue - let knownFolk = 1; - for(let j = 1; j++; j Latest changes: -
  • Religions update by center drag expansionism value
  • +
  • Religions update by center and expansionism value
  • +
  • Adding a culture manually also adds a folk religion for it
  • Lock states, provinces, cultures, and religions from regeneration
  • Heightmap brushes: linear edit option
  • Data Charts screen
  • From de3ed0d7057bd48d4837d73224b65ddcf629bef7 Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Mon, 20 Feb 2023 23:46:02 -0700 Subject: [PATCH 08/17] Religions UX: stable abbr, Folk non-selectable type & not separately removed --- modules/dynamic/editors/religions-editor.js | 28 +++++++++-------- modules/religions-generator.js | 33 +++++++++++++++------ 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index d39c9715..5e525c55 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -190,9 +190,7 @@ function religionsEditorAddLines() {
    ${si(area) + unit}
    ${si(population)}
    - + `; @@ -215,9 +213,15 @@ function religionsEditorAddLines() { - ${getTypeOptions(r.type)} - + ` + } @@ -227,19 +231,19 @@ function religionsEditorAddLines() {
    ${si(area) + unit}
    ${si(population)}
    - ${r.type == "Folk" ? + ${r.type === "Folk" ? ` - "culture" + culture ` - : + : `` } - +
    - + `; } $body.innerHTML = lines; @@ -295,7 +299,7 @@ function religionsEditorAddLines() { function getTypeOptions(type) { let options = ""; - const types = ["Folk", "Organized", "Cult", "Heresy"]; + const types = ["Organized", "Cult", "Heresy"]; types.forEach(t => (options += ``)); return options; } diff --git a/modules/religions-generator.js b/modules/religions-generator.js index fa36d8a6..78ce1f16 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -348,6 +348,7 @@ window.Religions = (function () { const religionIds = new Uint16Array(cells.culture); // cell religion; initially based on culture const religions = []; + const codes = []; // add folk religions pack.cultures.forEach(c => { @@ -376,6 +377,7 @@ window.Religions = (function () { lockedFolkReligion.i = newId; religions.push(lockedFolkReligion); + codes.push(lockedFolkReligion.code); return; } } @@ -384,6 +386,8 @@ window.Religions = (function () { const name = c.name + " " + rw(types[form]); const deity = form === "Animism" ? null : getDeityName(c.i); const color = getMixedColor(c.color, 0.1, 0); // `url(#hatch${rand(8,13)})`; + const code = abbreviate(name, codes); + codes.push(code); religions.push({ i: newId, name, @@ -393,7 +397,8 @@ window.Religions = (function () { form, deity, center: c.center, - origins: [0] + origins: [0], + code }); }); @@ -435,6 +440,7 @@ window.Religions = (function () { religion.origins = religion.origins.filter(origin => origin < newId); religionsTree.add(cells.p[religion.center]); religions.push(religion); + codes.push(religion.code); } } @@ -471,7 +477,9 @@ window.Religions = (function () { const expansionism = rand(3, 8); const baseColor = religions[culture]?.color || states[state]?.color || getRandomColor(); const color = getMixedColor(baseColor, 0.3, 0); + const code = abbreviate(name, codes); + codes.push(code); religions.push({ i: religions.length, name, @@ -483,7 +491,8 @@ window.Religions = (function () { expansion, expansionism, center, - origins + origins, + code }); religionsTree.add([x, y]); } @@ -506,6 +515,8 @@ window.Religions = (function () { const name = getCultName(form, center); const expansionism = gauss(1.1, 0.5, 0, 5); const color = getMixedColor(cultures[culture].color, 0.5, 0); // "url(#hatch7)"; + code = abbreviate(name, codes); + codes.push(code); religions.push({ i: religions.length, name, @@ -517,7 +528,8 @@ window.Religions = (function () { expansion: "global", expansionism, center, - origins + origins, + code }); religionsTree.add([x, y]); } @@ -544,6 +556,8 @@ window.Religions = (function () { const name = getCultName("Heresy", center); const expansionism = gauss(1.2, 0.5, 0, 5); const color = getMixedColor(r.color, 0.4, 0.2); // "url(#hatch6)"; + const code = abbreviate(name, codes); + codes.push(code); pack.religions.push({ i: pack.religions.length, name, @@ -555,7 +569,8 @@ window.Religions = (function () { expansion: "global", expansionism, center, - origins: [r.i] + origins: [r.i], + code }); religionsTree.add([x, y]); } @@ -657,13 +672,10 @@ window.Religions = (function () { } function checkReligionCenters() { - const codes = pack.religions.map(r => r.code); pack.religions.forEach(r => { if (!r.i) return; - r.code = abbreviate(r.name, codes); - // move religion center if it's not within religion area after expansion - if (pack.cells.religion[r.center] === r.i) return; // in area + if (r.type==="Folk" || pack.cells.religion[r.center] === r.i) return; // in area, or non-expanding const firstCell = pack.cells.i.find(i => pack.cells.religion[i] === r.i); if (firstCell) r.center = firstCell; // move center, othervise it's an extinct religion }); @@ -725,7 +737,10 @@ window.Religions = (function () { const form = rw(forms.Folk); const deity = form === "Animism" ? null : getDeityName(c.i); const name = c.name + " " + rw(types[form]); - const code = abbreviate(name); + const code = abbreviate( + name, + religions.map(r => r.code) + ); const newFolk = { i: c.i, name, From 81a19337a90669482822bb10926744b2f08dd15e Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Tue, 21 Feb 2023 01:55:45 -0700 Subject: [PATCH 09/17] Folk religions follow cultures through regeneration; extinct religion centers draw, folk centers are immutable and do not --- index.html | 2 +- modules/cultures-generator.js | 21 ++++++++++ modules/dynamic/editors/religions-editor.js | 2 +- modules/religions-generator.js | 46 +++++++++++---------- 4 files changed, 48 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index 3d7f4b33..cb428e3a 100644 --- a/index.html +++ b/index.html @@ -7845,7 +7845,7 @@ - + diff --git a/modules/cultures-generator.js b/modules/cultures-generator.js index 90f93d69..271fa055 100644 --- a/modules/cultures-generator.js +++ b/modules/cultures-generator.js @@ -127,6 +127,27 @@ window.Cultures = (function () { pack.cultures?.forEach(function (culture) { if (culture.lock) cultures.push(culture); }); + if(pack.religions?.length){ + const religMap=[]; + pack.religions.forEach(r => religMap.push(r.type === "Folk" ? 0 : r.i)); // remove folk religions in general + for(const j = 0; j < cultures.length; j++) { // locked cultures save their folk religions, at the new id + const k = j+1; + religMap[cultures[j].i] = k; + }); + for(const i of cells.i){ + cells.religion[i] = religMap[cells.religion[i]]; + } + for(const i = 0; i < religMap.length; i++){ + // update origin heirarchy to the new ids + pack.religions[i].origins = pack.religions[i].origins.map(i => religMap[i]).filter(i => i); + if(religMap[i] !== i){ + if(religMap[i] !== 0) + pack.religions[religMap[i]] = pack.religions[i]; + // folk religions for unlocked cultures are removed pending regeneration + pack.religions[i].removed = true; + } + } + } for (let culture, rnd, i = 0; cultures.length < count && i < 200; i++) { do { diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index 5e525c55..bf36e3d5 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -536,7 +536,7 @@ function drawReligionCenters() { .attr("stroke", "#444444") .style("cursor", "move"); - const data = pack.religions.filter(r => r.i && r.center && r.cells && !r.removed); + const data = pack.religions.filter(r => r.i && r.center && !r.type==="Folk" && !r.removed); religionCenters .selectAll("circle") .data(data) diff --git a/modules/religions-generator.js b/modules/religions-generator.js index 78ce1f16..dfe6a902 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -758,25 +758,26 @@ window.Religions = (function () { code }; - if(religions[c.i]){ - let rCargo = religions[c.i]; - if(rCargo.type === "Folk") return; - const newId = religions.length; - rCargo.i = newId; - for(const i of cells.i) { - if(cells.religion[i] = c.i) { - cells.religion[i] = newId; - } - } - religions.forEach(r => { - for(let j = 0; j < r.origins.length; j++) { - if(r.origins[j] === c.i) { - r.origins[j] === newid; - return; + if(c.i < religions.length){ + const rCargo = religions[c.i]; + if(!rCargo.removed) { + const newId = religions.length; + rCargo.i = newId; + for(const i of cells.i) { + if(cells.religion[i] = c.i) { + cells.religion[i] = newId; } } - }); - religions.push(rCargo); + religions.forEach(r => { + for(let j = 0; j < r.origins.length; j++) { + if(r.origins[j] === c.i) { + r.origins[j] === newid; + return; + } + } + }); + religions.push(rCargo); + } religions[c.i] = newFolk; } else { religions.push(newFolk); @@ -785,11 +786,14 @@ window.Religions = (function () { function updateCultures() { TIME && console.time("updateCulturesForReligions"); - pack.religions = pack.religions.map((religion, index) => { - if (index === 0) { - return religion; + pack.religions.forEach(r => { + if(r.i === 0) return; + if(!r.origins.length) r.origins = [0]; + if(r.type === "Folk"){ + if(r.removed) addFolk(pack.cultures[r.i].center); // regnerate folk religions for the regenerated cultures + else r.center = pack.cultures[r.i].center; } - return {...religion, culture: pack.cells.culture[religion.center]}; + else r.culture = pack.cells.culture[r.center]; }); TIME && console.timeEnd("updateCulturesForReligions"); } From c830bf31bac408641bfb5fe9c90703cadaf22237 Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Tue, 21 Feb 2023 19:05:11 -0700 Subject: [PATCH 10/17] style --- modules/cultures-generator.js | 34 +-- modules/dynamic/editors/religions-editor.js | 13 +- modules/religions-generator.js | 217 +++++++++++--------- 3 files changed, 139 insertions(+), 125 deletions(-) diff --git a/modules/cultures-generator.js b/modules/cultures-generator.js index 271fa055..a2a9dd09 100644 --- a/modules/cultures-generator.js +++ b/modules/cultures-generator.js @@ -127,24 +127,28 @@ window.Cultures = (function () { pack.cultures?.forEach(function (culture) { if (culture.lock) cultures.push(culture); }); - if(pack.religions?.length){ - const religMap=[]; - pack.religions.forEach(r => religMap.push(r.type === "Folk" ? 0 : r.i)); // remove folk religions in general - for(const j = 0; j < cultures.length; j++) { // locked cultures save their folk religions, at the new id - const k = j+1; - religMap[cultures[j].i] = k; - }); - for(const i of cells.i){ + + if (pack.religions?.length) { + const religions = pack.religions; + const religMap = []; + religions.forEach(r => religMap.push(r.type === "Folk" ? 0 : r.i)); // remove folk religions in general + + for (const j = 0; j < cultures.length; j++) { // locked cultures save their folk religions, at the new id + const newId = j + 1; + religMap[cultures[j].i] = newId; + }; + + for (const i of cells.i) { cells.religion[i] = religMap[cells.religion[i]]; } - for(const i = 0; i < religMap.length; i++){ + + for (const i = 0; i < religMap.length; i++) { // update origin heirarchy to the new ids - pack.religions[i].origins = pack.religions[i].origins.map(i => religMap[i]).filter(i => i); - if(religMap[i] !== i){ - if(religMap[i] !== 0) - pack.religions[religMap[i]] = pack.religions[i]; - // folk religions for unlocked cultures are removed pending regeneration - pack.religions[i].removed = true; + religions[i].origins = religions[i].origins.map(i => religMap[i]).filter(i => i); + if (religMap[i] !== i) { + if (religMap[i]) religions[religMap[i]] = religions[i]; + // unlocked folk religions for unlocked cultures are removed pending regeneration + if (!religions[i].locked) religions[i].removed = true; } } } diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index bf36e3d5..b13dd12d 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -190,7 +190,7 @@ function religionsEditorAddLines() {
    ${si(area) + unit}
    ${si(population)}
    - + `; @@ -236,7 +236,7 @@ function religionsEditorAddLines() { culture ` : - ` ${getExtentOptions(r.expansion)} ` } @@ -283,7 +283,7 @@ function religionsEditorAddLines() { $body.querySelectorAll("div > input.religionDeity").forEach(el => el.on("input", religionChangeDeity)); $body.querySelectorAll("div > span.icon-arrows-cw").forEach(el => el.on("click", regenerateDeity)); $body.querySelectorAll("div > div.religionPopulation").forEach(el => el.on("click", changePopulation)); - $body.querySelectorAll("div > select.religionLimit").forEach(el => el.on("change", religionChangeLimit)); + $body.querySelectorAll("div > select.religionExtent").forEach(el => el.on("change", religionChangeExtent)); $body.querySelectorAll("div > input.religionExpan").forEach(el => el.on("change", religionChangeExpansionism)); $body.querySelectorAll("div > span.icon-trash-empty").forEach(el => el.on("click", religionRemovePrompt)); $body.querySelectorAll("div > span.icon-lock").forEach($el => $el.on("click", updateLockStatus)); @@ -481,7 +481,7 @@ function changePopulation() { } } -function religionChangeLimit() { +function religionChangeExtent() { const religion = +this.parentNode.dataset.id; this.parentNode.dataset.expansion = this.value; pack.religions[religion].expansion = this.value; @@ -839,10 +839,7 @@ function updateLockStatus() { function recalculateReligions(must) { if (!must && !religionsAutoChange.checked) return; - Religions.resetUnlockedReligions(); - Religions.expandReligions(); - Religions.expandHeresies(); - Religions.checkReligionCenters(); + Religions.recalculate(); drawReligions(); refreshReligionsEditor(); diff --git a/modules/religions-generator.js b/modules/religions-generator.js index dfe6a902..3a80926c 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -578,109 +578,125 @@ window.Religions = (function () { expandHeresies(); - checkReligionCenters(); + checkCenters(); TIME && console.timeEnd("generateReligions"); }; - // growth algorithm to assign cells to religions - function expandReligions() { - const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p}); - const cost = []; - const religionIds = pack.cells.religion; - const cells = pack.cells; + // growth algorithm to assign cells to religions + function expandReligions() { + const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p}); + const cost = []; + const religionIds = pack.cells.religion; + const {cells, religions} = pack; - pack.religions - .filter(r => !r.lock && (r.type === "Organized" || r.type === "Cult")) - .forEach(r => { - religionIds[r.center] = r.i; - queue.queue({e: r.center, p: 0, r: r.i, s: cells.state[r.center], c: r.culture}); - cost[r.center] = 1; - }); + religions + .filter(r => !r.lock && (r.type === "Organized" || r.type === "Cult")) + .forEach(r => { + religionIds[r.center] = r.i; + queue.queue({e: r.center, p: 0, r: r.i, s: cells.state[r.center], c: r.culture}); + cost[r.center] = 1; + }); - const neutral = (cells.i.length / 5000) * 200 * gauss(1, 0.3, 0.2, 2, 2) * neutralInput.value; // limit cost for organized religions growth - const popCost = d3.max(cells.pop) / 3; // enougth population to spered religion without penalty + const neutral = (cells.i.length / 5000) * 200 * gauss(1, 0.3, 0.2, 2, 2) * neutralInput.value; // limit cost for organized religions growth + const popCost = d3.max(cells.pop) / 3; // enougth population to spered religion without penalty - while (queue.length) { - const {e, p, r, c, s} = queue.dequeue(); - const expansion = pack.religions[r].expansion; + while (queue.length) { + const {e, p, r, c, s} = queue.dequeue(); + const expansion = religions[r].expansion; - cells.c[e].forEach(nextCell => { - if (expansion === "culture" && c !== cells.culture[nextCell]) return; - if (expansion === "state" && s !== cells.state[nextCell]) return; - if (pack.religions[religionIds[nextCell]]?.lock) return; + cells.c[e].forEach(nextCell => { + if (expansion === "culture" && c !== cells.culture[nextCell]) return; + if (expansion === "state" && s !== cells.state[nextCell]) return; + if (religions[religionIds[nextCell]]?.lock) return; - const cultureCost = c !== cells.culture[nextCell] ? 10 : 0; - const stateCost = s !== cells.state[nextCell] ? 10 : 0; - const biomeCost = cells.road[nextCell] ? 1 : biomesData.cost[cells.biome[nextCell]]; - const populationCost = Math.max(rn(popCost - cells.pop[nextCell]), 0); - const heightCost = Math.max(cells.h[nextCell], 20) - 20; - const waterCost = cells.h[nextCell] < 20 ? (cells.road[nextCell] ? 50 : 1000) : 0; - const totalCost = - p + - (cultureCost + stateCost + biomeCost + populationCost + heightCost + waterCost) / pack.religions[r].expansionism; - if (totalCost > neutral) return; + const cultureCost = c !== cells.culture[nextCell] ? 10 : 0; + const stateCost = s !== cells.state[nextCell] ? 10 : 0; + const biomeCost = cells.road[nextCell] ? 1 : biomesData.cost[cells.biome[nextCell]]; + const populationCost = Math.max(rn(popCost - cells.pop[nextCell]), 0); + const heightCost = Math.max(cells.h[nextCell], 20) - 20; + const waterCost = cells.h[nextCell] < 20 ? (cells.road[nextCell] ? 50 : 1000) : 0; + const totalCost = + p + + (cultureCost + stateCost + biomeCost + populationCost + heightCost + waterCost) / religions[r].expansionism; + if (totalCost > neutral) return; - if (!cost[nextCell] || totalCost < cost[nextCell]) { - if (cells.h[nextCell] >= 20 && cells.culture[nextCell]) religionIds[nextCell] = r; // assign religion to cell - cost[nextCell] = totalCost; - queue.queue({e: nextCell, p: totalCost, r, c, s}); - } - }); - } - } - - // growth algorithm to assign cells to heresies - function expandHeresies() { - const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p}); - const cost = []; - const religionIds = pack.cells.religion; - const cells = pack.cells; - - pack.religions - .filter(r => !r.lock && r.type === "Heresy") - .forEach(r => { - const b = religionIds[r.center]; // "base" religion id - religionIds[r.center] = r.i; // heresy id - queue.queue({e: r.center, p: 0, r: r.i, b}); - cost[r.center] = 1; - }); - - const neutral = (cells.i.length / 5000) * 500 * neutralInput.value; // limit cost for heresies growth - - while (queue.length) { - const {e, p, r, b} = queue.dequeue(); - - cells.c[e].forEach(nextCell => { - if (pack.religions[religionIds[nextCell]]?.lock) return; - const religionCost = religionIds[nextCell] === b ? 0 : 2000; - const biomeCost = cells.road[nextCell] ? 0 : biomesData.cost[cells.biome[nextCell]]; - const heightCost = Math.max(cells.h[nextCell], 20) - 20; - const waterCost = cells.h[nextCell] < 20 ? (cells.road[nextCell] ? 50 : 1000) : 0; - const totalCost = - p + (religionCost + biomeCost + heightCost + waterCost) / Math.max(pack.religions[r].expansionism, 0.1); - - if (totalCost > neutral) return; - - if (!cost[nextCell] || totalCost < cost[nextCell]) { - if (cells.h[nextCell] >= 20 && cells.culture[nextCell]) religionIds[nextCell] = r; // assign religion to cell - cost[nextCell] = totalCost; - queue.queue({e: nextCell, p: totalCost, r}); - } - }); - } - } - - function checkReligionCenters() { - pack.religions.forEach(r => { - if (!r.i) return; - // move religion center if it's not within religion area after expansion - if (r.type==="Folk" || pack.cells.religion[r.center] === r.i) return; // in area, or non-expanding - const firstCell = pack.cells.i.find(i => pack.cells.religion[i] === r.i); - if (firstCell) r.center = firstCell; // move center, othervise it's an extinct religion + if (!cost[nextCell] || totalCost < cost[nextCell]) { + if (cells.h[nextCell] >= 20 && cells.culture[nextCell]) religionIds[nextCell] = r; // assign religion to cell + cost[nextCell] = totalCost; + queue.queue({e: nextCell, p: totalCost, r, c, s}); + } }); } + } + // growth algorithm to assign cells to heresies + function expandHeresies() { + const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p}); + const cost = []; + const religionIds = pack.cells.religion; + const {cells, religions} = pack; + + religions + .filter(r => !r.lock && r.type === "Heresy") + .forEach(r => { + const b = religionIds[r.center]; // "base" religion id + religionIds[r.center] = r.i; // heresy id + queue.queue({e: r.center, p: 0, r: r.i, b}); + cost[r.center] = 1; + }); + + const neutral = (cells.i.length / 5000) * 500 * neutralInput.value; // limit cost for heresies growth + + while (queue.length) { + const {e, p, r, b} = queue.dequeue(); + + cells.c[e].forEach(nextCell => { + if (religions[religionIds[nextCell]]?.lock) return; + const religionCost = religionIds[nextCell] === b ? 0 : 2000; + const biomeCost = cells.road[nextCell] ? 0 : biomesData.cost[cells.biome[nextCell]]; + const heightCost = Math.max(cells.h[nextCell], 20) - 20; + const waterCost = cells.h[nextCell] < 20 ? (cells.road[nextCell] ? 50 : 1000) : 0; + const totalCost = + p + (religionCost + biomeCost + heightCost + waterCost) / Math.max(religions[r].expansionism, 0.1); + + if (totalCost > neutral) return; + + if (!cost[nextCell] || totalCost < cost[nextCell]) { + if (cells.h[nextCell] >= 20 && cells.culture[nextCell]) religionIds[nextCell] = r; // assign religion to cell + cost[nextCell] = totalCost; + queue.queue({e: nextCell, p: totalCost, r}); + } + }); + } + } + + function checkCenters() { + const cells = pack.cells; + pack.religions.forEach(r => { + if (!r.i) return; + // move religion center if it's not within religion area after expansion + if (r.type==="Folk" || cells.religion[r.center] === r.i) return; // in area, or non-expanding + const firstCell = cells.i.find(i => cells.religion[i] === r.i); + if (firstCell) r.center = firstCell; // move center, othervise it's an extinct religion + }); + } + + function recalculate() { + const {religion, culture} = pack.cells; + // start with the culutres map, but also keep locked religions + for(const i of pack.cells.i){ + if( !pack.religions[religion[i]]?.lock ){ + religion[i] = culture[i]; + } + } + + expandReligions(); + expandHeresies(); + + checkCenters(); + } + const add = function (center) { const {cells, religions} = pack; const religionId = cells.religion[center]; @@ -717,7 +733,7 @@ window.Religions = (function () { form: formName, deity, expansion, - expansionism: 0.01, + expansionism: 0, center, cells: 0, area: 0, @@ -759,10 +775,12 @@ window.Religions = (function () { }; if(c.i < religions.length){ + // move an existing organized religion to the end of the array const rCargo = religions[c.i]; if(!rCargo.removed) { const newId = religions.length; rCargo.i = newId; + for(const i of cells.i) { if(cells.religion[i] = c.i) { cells.religion[i] = newId; @@ -776,8 +794,10 @@ window.Religions = (function () { } } }); + religions.push(rCargo); } + religions[c.i] = newFolk; } else { religions.push(newFolk); @@ -788,11 +808,14 @@ window.Religions = (function () { TIME && console.time("updateCulturesForReligions"); pack.religions.forEach(r => { if(r.i === 0) return; + if(!r.origins.length) r.origins = [0]; + if(r.type === "Folk"){ if(r.removed) addFolk(pack.cultures[r.i].center); // regnerate folk religions for the regenerated cultures else r.center = pack.cultures[r.i].center; } + // set new namebase culture else r.culture = pack.cells.culture[r.center]; }); TIME && console.timeEnd("updateCulturesForReligions"); @@ -874,15 +897,5 @@ window.Religions = (function () { return type() + " of the " + generateMeaning(); } - const resetUnlockedReligions = function() { - const {religion, culture} = pack.cells; - - for(const i of pack.cells.i){ - if( !pack.religions[religion[i]]?.lock ){ - religion[i] = culture[i]; - } - } - }; - - return {generate, expandReligions, expandHeresies, checkReligionCenters, add, addFolk, getDeityName, updateCultures, resetUnlockedReligions}; + return {generate, add, addFolk, getDeityName, updateCultures, recalculate}; })(); From b7bcf96a2580eb8cfbe6fa452e579fb3f3264c74 Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Tue, 21 Feb 2023 21:32:55 -0700 Subject: [PATCH 11/17] regenerate bugs fixing --- modules/cultures-generator.js | 21 ++-- modules/dynamic/editors/religions-editor.js | 6 +- modules/religions-generator.js | 108 +++++++++++--------- 3 files changed, 71 insertions(+), 64 deletions(-) diff --git a/modules/cultures-generator.js b/modules/cultures-generator.js index a2a9dd09..6925bfdc 100644 --- a/modules/cultures-generator.js +++ b/modules/cultures-generator.js @@ -128,12 +128,13 @@ window.Cultures = (function () { if (culture.lock) cultures.push(culture); }); - if (pack.religions?.length) { + if (cultures.length && pack.religions?.length > 1) { const religions = pack.religions; const religMap = []; religions.forEach(r => religMap.push(r.type === "Folk" ? 0 : r.i)); // remove folk religions in general - for (const j = 0; j < cultures.length; j++) { // locked cultures save their folk religions, at the new id + for (let j = 0; j < cultures.length; j++) { + // locked cultures bring their folk religions along to the new id const newId = j + 1; religMap[cultures[j].i] = newId; }; @@ -142,15 +143,15 @@ window.Cultures = (function () { cells.religion[i] = religMap[cells.religion[i]]; } - for (const i = 0; i < religMap.length; i++) { + religions.forEach(r => { + if (r.i === 0) return; + // queue for movement to newId, or removal + if (religMap[r.i]) r.i = religMap[r.i]; + else r.removed = !r.locked; + // update origin heirarchy to the new ids - religions[i].origins = religions[i].origins.map(i => religMap[i]).filter(i => i); - if (religMap[i] !== i) { - if (religMap[i]) religions[religMap[i]] = religions[i]; - // unlocked folk religions for unlocked cultures are removed pending regeneration - if (!religions[i].locked) religions[i].removed = true; - } - } + r.origins = r.origins.map(i => religMap[i]).filter(i => i); + }); } for (let culture, rnd, i = 0; cultures.length < count && i < 200; i++) { diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index b13dd12d..f4e8c086 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -240,10 +240,10 @@ function religionsEditorAddLines() { ${getExtentOptions(r.expansion)} ` } - + - + `; } $body.innerHTML = lines; diff --git a/modules/religions-generator.js b/modules/religions-generator.js index 3a80926c..35c8247d 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -381,25 +381,10 @@ window.Religions = (function () { return; } } - - const form = rw(forms.Folk); - const name = c.name + " " + rw(types[form]); - const deity = form === "Animism" ? null : getDeityName(c.i); - const color = getMixedColor(c.color, 0.1, 0); // `url(#hatch${rand(8,13)})`; - const code = abbreviate(name, codes); - codes.push(code); - religions.push({ - i: newId, - name, - color, - culture: newId, - type: "Folk", - form, - deity, - center: c.center, - origins: [0], - code - }); + + const newFolk = createFolk(c, codes); + codes.push(newFolk.code); + religions.push(newFolk); }); if (religionsInput.value == 0 || pack.cultures.length < 2) { @@ -515,7 +500,7 @@ window.Religions = (function () { const name = getCultName(form, center); const expansionism = gauss(1.1, 0.5, 0, 5); const color = getMixedColor(cultures[culture].color, 0.5, 0); // "url(#hatch7)"; - code = abbreviate(name, codes); + const code = abbreviate(name, codes); codes.push(code); religions.push({ i: religions.length, @@ -582,6 +567,27 @@ window.Religions = (function () { TIME && console.timeEnd("generateReligions"); }; + + function createFolk(c, codes) { + + const form = rw(forms.Folk); + const name = c.name + " " + rw(types[form]); + const deity = form === "Animism" ? null : getDeityName(c.i); + const color = getMixedColor(c.color, 0.1, 0); + const code = abbreviate(name, codes); + return { + i: c.i, + name, + color, + culture: c.i, + type: "Folk", + form, + deity, + center: c.center, + origins: [0], + code + }; + } // growth algorithm to assign cells to religions function expandReligions() { @@ -749,35 +755,13 @@ window.Religions = (function () { const {cultures, religions, cells} = pack; const c = cultures.find(c => !c.removed && c.center === center); - const color = getMixedColor(c.color, 0.1, 0); - const form = rw(forms.Folk); - const deity = form === "Animism" ? null : getDeityName(c.i); - const name = c.name + " " + rw(types[form]); - const code = abbreviate( - name, - religions.map(r => r.code) - ); - const newFolk = { - i: c.i, - name, - color, - culture: c.i, - type: "Folk", - form, - deity, - center: center, - cells: 0, - area: 0, - rural: 0, - urban: 0, - origins: [0], - code - }; + const codes = religions.map(r => r.code); + const newFolk = createFolk(c, codes); if(c.i < religions.length){ // move an existing organized religion to the end of the array const rCargo = religions[c.i]; - if(!rCargo.removed) { + if(!rCargo.removed && rCargo.type != "Folk") { const newId = religions.length; rCargo.i = newId; @@ -787,9 +771,10 @@ window.Religions = (function () { } } religions.forEach(r => { + if (r.i === 0) return; for(let j = 0; j < r.origins.length; j++) { if(r.origins[j] === c.i) { - r.origins[j] === newid; + r.origins[j] === newId; return; } } @@ -806,17 +791,38 @@ window.Religions = (function () { function updateCultures() { TIME && console.time("updateCulturesForReligions"); + const religions = []; + for (let i=0; i < pack.religions.length; i++) { + const faith = pack.religions.find(r => r.i === i); + if (faith) { + if (faith.type === "Folk" && faith.removed && !pack.cultures[i].removed) { + const codes = religions.map(r => r.code); + religions.push(createFolk(c, codes)); + } + else religions.push(faith); + } + else religions.push({ + i, + name: "removed index", + origins: [null], + removed: true + }); + } + + pack.religions = religions; + pack.religions.forEach(r => { if(r.i === 0) return; - if(!r.origins.length) r.origins = [0]; + if(r.origins?.length < 1) r.origins = [0]; if(r.type === "Folk"){ - if(r.removed) addFolk(pack.cultures[r.i].center); // regnerate folk religions for the regenerated cultures - else r.center = pack.cultures[r.i].center; + r.center = pack.cultures[r.i].center; + } + else { + r.culture = pack.cells.culture[r.center]; + if (r.i < pack.cultures.length) addFolk(pack.cultures[r.i].center); } - // set new namebase culture - else r.culture = pack.cells.culture[r.center]; }); TIME && console.timeEnd("updateCulturesForReligions"); } From e4a7a6ecf2ef0fdb7c788ad322facc4fdcf0cfff Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Wed, 22 Feb 2023 22:35:47 -0700 Subject: [PATCH 12/17] when cultures regenerate a different number --- modules/cultures-generator.js | 31 +++++++++--- modules/religions-generator.js | 92 +++++++++++++++++++++++++--------- 2 files changed, 93 insertions(+), 30 deletions(-) diff --git a/modules/cultures-generator.js b/modules/cultures-generator.js index 6925bfdc..f29a4d53 100644 --- a/modules/cultures-generator.js +++ b/modules/cultures-generator.js @@ -138,21 +138,40 @@ window.Cultures = (function () { const newId = j + 1; religMap[cultures[j].i] = newId; }; - - for (const i of cells.i) { - cells.religion[i] = religMap[cells.religion[i]]; - } - + religions.forEach(r => { if (r.i === 0) return; // queue for movement to newId, or removal if (religMap[r.i]) r.i = religMap[r.i]; - else r.removed = !r.locked; + else if (r.locked) { + // locked folk religion getting a new culture + if (religMap.find(r.i) > 0) { // something already there, shift away from conflict + const nextId = religMap.find(0); + if (nextId > 0) { + religMap[r.i] = nextId; + r.i = nextId; + } + else { // none available... + religMap[r.i] = religMap.length; + r.i = religMap.length; + religMap.push(r.i); + } + } + } + else r.removed = true; // the unlocked folk religions that were left behind by unlocked cultures // update origin heirarchy to the new ids r.origins = r.origins.map(i => religMap[i]).filter(i => i); }); + + for (const i of cells.i) { + cells.religion[i] = religMap[cells.religion[i]]; + } } + pack.religions?.forEach(r => { + if (r.type === "Folk" && !r.locked) + cell.religion = cells.religion.map(ri => ri === r.i ? 0 : ri); + }); for (let culture, rnd, i = 0; cultures.length < count && i < 200; i++) { do { diff --git a/modules/religions-generator.js b/modules/religions-generator.js index 35c8247d..7ba513be 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -784,44 +784,88 @@ window.Religions = (function () { } religions[c.i] = newFolk; - } else { - religions.push(newFolk); - } + } + else religions.push(newFolk); }; function updateCultures() { TIME && console.time("updateCulturesForReligions"); - const religions = []; - for (let i=0; i < pack.religions.length; i++) { - const faith = pack.religions.find(r => r.i === i); - if (faith) { - if (faith.type === "Folk" && faith.removed && !pack.cultures[i].removed) { - const codes = religions.map(r => r.code); - religions.push(createFolk(c, codes)); + const {religions, cultures, cells} = pack; + + const tReligions = []; + const spareCovenants = []; + const codes = religions.filter(r => !r.removed).map(r => r.code); + + tReligions.push(religions[0]); + for (let i = 1; i < cultures.length; i++) { + const faith = religions.find(r => r.i === i); + if (faith && !faith.removed) { + if (faith.type === "Folk") { + tReligions.push(faith); + continue; } - else religions.push(faith); + else spareCovenants.push(faith); } - else religions.push({ - i, - name: "removed index", - origins: [null], - removed: true - }); + const newFolk = createFolk(cultures[i], codes); + tReligions.push(newFolk); + codes.push(newFolk.code); + } + for (let i = cultures.length; i < religions.length; i++) { + const faith = religions.find(r => r.i === i); + if (faith) { + if (faith.type === "Folk" && !faith.locked) + tReligions.push({...faith, removed: true})); + else tReligions.push(faith); + } + else tReligions.push({ + i, + name: "filler index", + origins: [null], + removed: true + }); } - pack.religions = religions; + const updateMap = []; + for (let k = 0; k < spareCovenants.length; k++) { + const sc = spareCovenants[k]; + const newId = tReligions.length; + + for (const i of cells.i) { + if (cells.religion[i] = sc.i) { + cells.religion[i] = newId; + } + } + + updateMap.push({oldId: sc.i, newId}); + tReligions.forEach(r => { + if (r.i === 0) return; + for (let i = 0; i < r.origins.length; i++) { + if (r.origins[i] === sc.i) { + r.origins[i] === newId; + return; + } + } + }); + // update origins from other spareCovenants + for (let i = 0; i < sc.origins.length; i++) { + const changeRule = updateMap.find(u => u.oldId === sc.origins[i]) + if (changeRule) sc.origins[i] = changeRule.newId; + } + tReligions.push({...sc, i: newId}); + } + + pack.religions = tReligions; pack.religions.forEach(r => { - if(r.i === 0) return; + if (r.i === 0) return; - if(r.origins?.length < 1) r.origins = [0]; + if (r.origins?.length < 1) r.origins = [0]; - if(r.type === "Folk"){ - r.center = pack.cultures[r.i].center; + if (r.type === "Folk"){ + r.center = cultures[r.i].center; } else { - r.culture = pack.cells.culture[r.center]; - if (r.i < pack.cultures.length) addFolk(pack.cultures[r.i].center); + r.culture = cells.culture[r.center]; } }); TIME && console.timeEnd("updateCulturesForReligions"); From 2ea53d2688505ec2e0da1a74dfdf68d050e98ebf Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Thu, 23 Feb 2023 00:06:50 -0700 Subject: [PATCH 13/17] ability to lock culture in a easy-defined set fixes uncaught error in commit dada419 from PR #910 --- modules/cultures-generator.js | 90 ++++++++++++++++++---------------- modules/religions-generator.js | 4 +- 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/modules/cultures-generator.js b/modules/cultures-generator.js index f29a4d53..4e0b47ba 100644 --- a/modules/cultures-generator.js +++ b/modules/cultures-generator.js @@ -118,69 +118,75 @@ window.Cultures = (function () { function selectCultures(c) { let def = getDefault(c); - if (c === def.length) return def; - if (def.every(d => d.odd === 1)) return def.splice(0, c); - - const count = Math.min(c, def.length); const cultures = []; pack.cultures?.forEach(function (culture) { if (culture.lock) cultures.push(culture); }); - if (cultures.length && pack.religions?.length > 1) { - const religions = pack.religions; - const religMap = []; - religions.forEach(r => religMap.push(r.type === "Folk" ? 0 : r.i)); // remove folk religions in general + if (cultures.length) { - for (let j = 0; j < cultures.length; j++) { - // locked cultures bring their folk religions along to the new id - const newId = j + 1; - religMap[cultures[j].i] = newId; - }; + if (pack.religions?.length > 1) { + const religions = pack.religions; + const religMap = []; + religions.forEach(r => religMap.push(r.type === "Folk" ? 0 : r.i)); // remove folk religions in general + + for (let j = 0; j < cultures.length; j++) { + // locked cultures bring their folk religions along to the new id + const newId = j + 1; + religMap[cultures[j].i] = newId; + }; - religions.forEach(r => { - if (r.i === 0) return; - // queue for movement to newId, or removal - if (religMap[r.i]) r.i = religMap[r.i]; - else if (r.locked) { - // locked folk religion getting a new culture - if (religMap.find(r.i) > 0) { // something already there, shift away from conflict - const nextId = religMap.find(0); - if (nextId > 0) { - religMap[r.i] = nextId; - r.i = nextId; - } - else { // none available... - religMap[r.i] = religMap.length; - r.i = religMap.length; - religMap.push(r.i); + religions.forEach(r => { + if (r.i === 0) return; + // queue for movement to newId, or removal + if (religMap[r.i]) r.i = religMap[r.i]; + else if (r.locked) { + // locked folk religion getting a new culture + if (religMap.find(r.i) > 0) { // something already there, shift away from conflict + const nextId = religMap.find(0); + if (nextId > 0) { + religMap[r.i] = nextId; + r.i = nextId; + } + else { // none available... + religMap[r.i] = religMap.length; + r.i = religMap.length; + religMap.push(r.i); + } } } - } - else r.removed = true; // the unlocked folk religions that were left behind by unlocked cultures + else r.removed = true; // the unlocked folk religions that were left behind by unlocked cultures + + // update origin heirarchy to the new ids + r.origins = r.origins.map(i => religMap[i]).filter(i => i); + }); - // update origin heirarchy to the new ids - r.origins = r.origins.map(i => religMap[i]).filter(i => i); - }); - - for (const i of cells.i) { - cells.religion[i] = religMap[cells.religion[i]]; - } + for (const i of cells.i) { + cells.religion[i] = religMap[cells.religion[i]]; + } + } + } else { + if (c === def.length) return def; + if (def.every(d => d.odd === 1)) return def.splice(0, c); } + pack.religions?.forEach(r => { if (r.type === "Folk" && !r.locked) - cell.religion = cells.religion.map(ri => ri === r.i ? 0 : ri); + cells.religion = cells.religion.map(ri => ri === r.i ? 0 : ri); }); - for (let culture, rnd, i = 0; cultures.length < count && i < 200; i++) { + let culture, rnd; + let i = 0; + do { do { rnd = rand(def.length - 1); culture = def[rnd]; - } while (!P(culture.odd)); + i++; + } while (i < 200 && !P(culture.odd)); cultures.push(culture); def.splice(rnd, 1); - } + } while (cultures.length < c && def.length > 0); return cultures; } diff --git a/modules/religions-generator.js b/modules/religions-generator.js index 7ba513be..14a98ec5 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -814,7 +814,7 @@ window.Religions = (function () { const faith = religions.find(r => r.i === i); if (faith) { if (faith.type === "Folk" && !faith.locked) - tReligions.push({...faith, removed: true})); + tReligions.push({...faith, removed: true}); else tReligions.push(faith); } else tReligions.push({ @@ -861,7 +861,7 @@ window.Religions = (function () { if (r.origins?.length < 1) r.origins = [0]; - if (r.type === "Folk"){ + if (r.type === "Folk" && cultures[r.i]) { r.center = cultures[r.i].center; } else { From 1c3ec99c598360334fd3e72c4d4421f6e3c23d44 Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Thu, 23 Feb 2023 12:44:29 -0700 Subject: [PATCH 14/17] what is locked folk? --- modules/cultures-generator.js | 40 +++++++-------------- modules/dynamic/editors/religions-editor.js | 23 +++++++----- modules/religions-generator.js | 2 +- versioning.js | 2 +- 4 files changed, 29 insertions(+), 38 deletions(-) diff --git a/modules/cultures-generator.js b/modules/cultures-generator.js index 4e0b47ba..db8fb06a 100644 --- a/modules/cultures-generator.js +++ b/modules/cultures-generator.js @@ -125,8 +125,7 @@ window.Cultures = (function () { }); if (cultures.length) { - - if (pack.religions?.length > 1) { + if (pack.religions?.length > 2) { const religions = pack.religions; const religMap = []; religions.forEach(r => religMap.push(r.type === "Folk" ? 0 : r.i)); // remove folk religions in general @@ -139,24 +138,11 @@ window.Cultures = (function () { religions.forEach(r => { if (r.i === 0) return; - // queue for movement to newId, or removal + // queue for movement to new id, or removal if (religMap[r.i]) r.i = religMap[r.i]; - else if (r.locked) { - // locked folk religion getting a new culture - if (religMap.find(r.i) > 0) { // something already there, shift away from conflict - const nextId = religMap.find(0); - if (nextId > 0) { - religMap[r.i] = nextId; - r.i = nextId; - } - else { // none available... - religMap[r.i] = religMap.length; - r.i = religMap.length; - religMap.push(r.i); - } - } + else { + r.removed = true; // the folk religions that were left behind by unlocked cultures } - else r.removed = true; // the unlocked folk religions that were left behind by unlocked cultures // update origin heirarchy to the new ids r.origins = r.origins.map(i => religMap[i]).filter(i => i); @@ -164,21 +150,19 @@ window.Cultures = (function () { for (const i of cells.i) { cells.religion[i] = religMap[cells.religion[i]]; - } + } } } else { if (c === def.length) return def; if (def.every(d => d.odd === 1)) return def.splice(0, c); + if (pack.religions?.length > 2) { + pack.religions.forEach(r => { + if (r.type === "Folk" && !r.lock) r.removed = true; + }); + } } - pack.religions?.forEach(r => { - if (r.type === "Folk" && !r.locked) - cells.religion = cells.religion.map(ri => ri === r.i ? 0 : ri); - }); - - let culture, rnd; - let i = 0; - do { + for (let culture, rnd, i = 0; cultures.length < c && def.length > 0;) { do { rnd = rand(def.length - 1); culture = def[rnd]; @@ -186,7 +170,7 @@ window.Cultures = (function () { } while (i < 200 && !P(culture.odd)); cultures.push(culture); def.splice(rnd, 1); - } while (cultures.length < c && def.length > 0); + } return cultures; } diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index f4e8c086..fb7e1e07 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -234,16 +234,22 @@ function religionsEditorAddLines() { ${r.type === "Folk" ? ` culture - ` + + + + + ` : `` - } - + + - + ` + } `; } $body.innerHTML = lines; diff --git a/modules/religions-generator.js b/modules/religions-generator.js index 14a98ec5..44426f59 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -813,7 +813,7 @@ window.Religions = (function () { for (let i = cultures.length; i < religions.length; i++) { const faith = religions.find(r => r.i === i); if (faith) { - if (faith.type === "Folk" && !faith.locked) + if (faith.type === "Folk" && !faith.lock) tReligions.push({...faith, removed: true}); else tReligions.push(faith); } diff --git a/versioning.js b/versioning.js index 18173fac..b140206a 100644 --- a/versioning.js +++ b/versioning.js @@ -29,7 +29,7 @@ const version = "1.90.00"; // generator version, update each time
      Latest changes:
    • Religions update by center and expansionism value
    • -
    • Adding a culture manually also adds a folk religion for it
    • +
    • Adding, removing, and regenerating cultures also affect the linked folk religion
    • Lock states, provinces, cultures, and religions from regeneration
    • Heightmap brushes: linear edit option
    • Data Charts screen
    • From 5e127df8a58e45fd19d93eaa6a4c44835880618e Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Thu, 23 Feb 2023 13:23:24 -0700 Subject: [PATCH 15/17] New Map ignores old locked things --- main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.js b/main.js index 69323e92..d3b290b8 100644 --- a/main.js +++ b/main.js @@ -2038,6 +2038,8 @@ const regenerateMap = debounce(async function (options) { customization = 0; resetZoom(1000); undraw(); + pack.religions = []; + pack.cultures = []; await generate(options); restoreLayers(); if (ThreeD.options.isOn) ThreeD.redraw(); From 403259d5a45bc27f9c8826a350d7a641fe09ada2 Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Fri, 24 Feb 2023 03:35:42 -0700 Subject: [PATCH 16/17] No auto-update of religion on culture regeneration --- modules/cultures-generator.js | 35 +-------------------- modules/dynamic/editors/religions-editor.js | 2 +- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/modules/cultures-generator.js b/modules/cultures-generator.js index cb8473ca..132622a3 100644 --- a/modules/cultures-generator.js +++ b/modules/cultures-generator.js @@ -124,42 +124,9 @@ window.Cultures = (function () { if (culture.lock) cultures.push(culture); }); - if (cultures.length) { - if (pack.religions?.length > 2) { - const religions = pack.religions; - const religMap = []; - religions.forEach(r => religMap.push(r.type === "Folk" ? 0 : r.i)); // remove folk religions in general - - for (let j = 0; j < cultures.length; j++) { - // locked cultures bring their folk religions along to the new id - const newId = j + 1; - religMap[cultures[j].i] = newId; - }; - - religions.forEach(r => { - if (r.i === 0) return; - // queue for movement to new id, or removal - if (religMap[r.i]) r.i = religMap[r.i]; - else { - r.removed = true; // the folk religions that were left behind by unlocked cultures - } - - // update origin heirarchy to the new ids - r.origins = r.origins.map(i => religMap[i]).filter(i => i); - }); - - for (const i of cells.i) { - cells.religion[i] = religMap[cells.religion[i]]; - } - } - } else { + if (!cultures.length) { if (culturesNumber === def.length) return def; if (def.every(d => d.odd === 1)) return def.splice(0, culturesNumber); - if (pack.religions?.length > 2) { - pack.religions.forEach(r => { - if (r.type === "Folk" && !r.lock) r.removed = true; - }); - } } for (let culture, rnd, i = 0; cultures.length < culturesNumber && def.length > 0;) { diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js index fb7e1e07..2d85015c 100644 --- a/modules/dynamic/editors/religions-editor.js +++ b/modules/dynamic/editors/religions-editor.js @@ -238,7 +238,7 @@ function religionsEditorAddLines() { ` From e681c2af5c8701fc6bfc18fa44dede28afab0a95 Mon Sep 17 00:00:00 2001 From: Canis Artorus Date: Fri, 24 Feb 2023 03:41:49 -0700 Subject: [PATCH 17/17] typo --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index ce7f00e2..e32869c3 100644 --- a/index.html +++ b/index.html @@ -7846,7 +7846,7 @@ - +