From a3605dd49718617b626dfa6d416a51f479b569f0 Mon Sep 17 00:00:00 2001 From: Alexander James Date: Sun, 26 Mar 2023 09:10:02 -0600 Subject: [PATCH] Prevent generating cyclical heirarchy --- modules/religions-generator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/religions-generator.js b/modules/religions-generator.js index aa83885a..0ebd226d 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -597,7 +597,7 @@ window.Religions = (function () { checked[neibId] = true; const neibReligion = religionIds[neibId]; - if (neibReligion && neibReligion !== religionId) foundReligions.add(neibReligion); + if (neibReligion && neibReligion < religionId) foundReligions.add(neibReligion); if (foundReligions.size >= maxReligions) return [...foundReligions]; queue.push(neibId); } @@ -714,6 +714,7 @@ window.Religions = (function () { const add = function (center) { const {cells, cultures, religions} = pack; const religionId = cells.religion[center]; + const i = religions.length; const cultureId = cells.culture[center]; const missingFolk = @@ -741,10 +742,9 @@ window.Religions = (function () { name, religions.map(r => r.code) ); - const influences = getReligionsInRadius(cells.c, center, cells.religion, 0, 25, 3, 0); + const influences = getReligionsInRadius(cells.c, center, cells.religion, i, 25, 3, 0); const origins = type === "Folk" ? [0] : influences; - const i = religions.length; religions.push({ i, name,