mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 12:01:23 +01:00
Bugfixes
This commit is contained in:
parent
f018256f7a
commit
64764dcd78
3 changed files with 12 additions and 9 deletions
|
|
@ -118,21 +118,23 @@ window.Cultures = (function () {
|
|||
|
||||
function selectCultures(culturesNumber) {
|
||||
let def = getDefault(culturesNumber);
|
||||
if (culturesNumber === def.length) return def;
|
||||
if (def.every(d => d.odd === 1)) return def.splice(0, culturesNumber);
|
||||
|
||||
const count = Math.min(culturesNumber, def.length);
|
||||
|
||||
const cultures = [];
|
||||
pack.cultures?.forEach(function (culture) {
|
||||
if (culture.lock) cultures.push(culture);
|
||||
});
|
||||
|
||||
if (!cultures.length) {
|
||||
if (culturesNumber === def.length) return def;
|
||||
if (def.every(d => d.odd === 1)) return def.splice(0, culturesNumber);
|
||||
}
|
||||
|
||||
for (let culture, rnd, i = 0; cultures.length < count && i < 200; i++) {
|
||||
for (let culture, rnd, i = 0; cultures.length < culturesNumber && def.length > 0;) {
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export function open() {
|
|||
closeDialogs("#religionsEditor, .stable");
|
||||
if (layerIsOn("toggleStates")) toggleStates();
|
||||
if (layerIsOn("toggleBiomes")) toggleBiomes();
|
||||
if (layerIsOn("toggleCultures")) toggleReligions();
|
||||
if (layerIsOn("toggleCultures")) toggleCultures();
|
||||
if (layerIsOn("toggleProvinces")) toggleProvinces();
|
||||
if (!layerIsOn("toggleReligions")) toggleReligions();
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ function religionsEditorAddLines() {
|
|||
<span data-tip="${populationTip}" class="icon-male hide"></span>
|
||||
<div data-tip="${populationTip}" class="religionPopulation hide pointer">${si(population)}</div>
|
||||
<span
|
||||
data-tip="Lock religion, will regenerate the origin folk and organized religion if they are not also locked"
|
||||
data-tip="Lock this religion"
|
||||
class="icon-lock${r.lock ? "" : "-open"} hide"
|
||||
></span>
|
||||
<span data-tip="Remove religion" class="icon-trash-empty hide"></span>
|
||||
|
|
@ -475,7 +475,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.removed);
|
||||
religionCenters
|
||||
.selectAll("circle")
|
||||
.data(data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue