mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
fix(religions): don't throw error if religion culture is 0 (happens if culture is removed)
This commit is contained in:
parent
12fad8fd8f
commit
440430e415
2 changed files with 3 additions and 4 deletions
|
|
@ -5617,7 +5617,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="iconSelector" style="display: none" class="dialog">
|
<div id="iconSelector" style="display: none" class="dialog">
|
||||||
<table id="iconTable" class="table pointer" style="font-size: 2em; text-align: center"></table>
|
<table id="iconTable" class="table pointer" style="font-size: 2em; text-align: center; width: 100%"></table>
|
||||||
<div style="font-style: italic; font-size: 1.2em; margin: 0.4em 0 0 0.4em">
|
<div style="font-style: italic; font-size: 1.2em; margin: 0.4em 0 0 0.4em">
|
||||||
<span>Select from the list or paste a Unicode character here: </span>
|
<span>Select from the list or paste a Unicode character here: </span>
|
||||||
<input id="iconInput" style="width: 2em" />
|
<input id="iconInput" style="width: 2em" />
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ window.Religions = (function () {
|
||||||
|
|
||||||
function generate() {
|
function generate() {
|
||||||
TIME && console.time("generateReligions");
|
TIME && console.time("generateReligions");
|
||||||
const lockedReligions = pack.religions?.filter(religion => r.i && religion.lock && !religion.removed) || [];
|
const lockedReligions = pack.religions?.filter(r => r.i && r.lock && !r.removed) || [];
|
||||||
|
|
||||||
const folkReligions = generateFolkReligions();
|
const folkReligions = generateFolkReligions();
|
||||||
const organizedReligions = generateOrganizedReligions(+religionsInput.value, lockedReligions);
|
const organizedReligions = generateOrganizedReligions(+religionsInput.value, lockedReligions);
|
||||||
|
|
@ -468,7 +468,6 @@ window.Religions = (function () {
|
||||||
if (expansion === "state" && !stateId) expansion = "global";
|
if (expansion === "state" && !stateId) expansion = "global";
|
||||||
|
|
||||||
const expansionism = expansionismMap[type]();
|
const expansionism = expansionismMap[type]();
|
||||||
|
|
||||||
const color = getReligionColor(cultures[cultureId], type);
|
const color = getReligionColor(cultures[cultureId], type);
|
||||||
|
|
||||||
return {name, type, form, culture: cultureId, center, deity, expansion, expansionism, color};
|
return {name, type, form, culture: cultureId, center, deity, expansion, expansionism, color};
|
||||||
|
|
@ -477,7 +476,7 @@ window.Religions = (function () {
|
||||||
return rawReligions;
|
return rawReligions;
|
||||||
|
|
||||||
function getReligionColor(culture, type) {
|
function getReligionColor(culture, type) {
|
||||||
if (!culture.i) ERROR && console.error(`Culture ${culture.i} is not a valid culture`);
|
if (!culture.i) return getRandomColor();
|
||||||
|
|
||||||
if (type === "Folk") return culture.color;
|
if (type === "Folk") return culture.color;
|
||||||
if (type === "Heresy") return getMixedColor(culture.color, 0.35, 0.2);
|
if (type === "Heresy") return getMixedColor(culture.color, 0.35, 0.2);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue