Prevent generating cyclical heirarchy

This commit is contained in:
Alexander James 2023-03-26 09:10:02 -06:00 committed by GitHub
parent 5c0254afd8
commit a3605dd497
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -597,7 +597,7 @@ window.Religions = (function () {
checked[neibId] = true; checked[neibId] = true;
const neibReligion = religionIds[neibId]; const neibReligion = religionIds[neibId];
if (neibReligion && neibReligion !== religionId) foundReligions.add(neibReligion); if (neibReligion && neibReligion < religionId) foundReligions.add(neibReligion);
if (foundReligions.size >= maxReligions) return [...foundReligions]; if (foundReligions.size >= maxReligions) return [...foundReligions];
queue.push(neibId); queue.push(neibId);
} }
@ -714,6 +714,7 @@ window.Religions = (function () {
const add = function (center) { const add = function (center) {
const {cells, cultures, religions} = pack; const {cells, cultures, religions} = pack;
const religionId = cells.religion[center]; const religionId = cells.religion[center];
const i = religions.length;
const cultureId = cells.culture[center]; const cultureId = cells.culture[center];
const missingFolk = const missingFolk =
@ -741,10 +742,9 @@ window.Religions = (function () {
name, name,
religions.map(r => r.code) 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 origins = type === "Folk" ? [0] : influences;
const i = religions.length;
religions.push({ religions.push({
i, i,
name, name,