mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
Prevent generating cyclical heirarchy
This commit is contained in:
parent
5c0254afd8
commit
a3605dd497
1 changed files with 3 additions and 3 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue