mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
Religions update cultures on culture regeneration
Updated function names to be more similar and more descriptive
This commit is contained in:
parent
913c9b0f01
commit
6b73387896
3 changed files with 18 additions and 6 deletions
|
|
@ -355,8 +355,8 @@
|
||||||
|
|
||||||
// Resets the cultures of all burgs and states to their
|
// Resets the cultures of all burgs and states to their
|
||||||
// cell or center cell's (respectively) culture.
|
// cell or center cell's (respectively) culture.
|
||||||
const resetCultures = function () {
|
const updateCultures = function () {
|
||||||
console.time('resetCulturesForBurgsAndStates');
|
console.time('updateCulturesForBurgsAndStates');
|
||||||
|
|
||||||
// Assign the culture associated with the burgs cell.
|
// Assign the culture associated with the burgs cell.
|
||||||
pack.burgs = pack.burgs.map( (burg, index) => {
|
pack.burgs = pack.burgs.map( (burg, index) => {
|
||||||
|
|
@ -376,7 +376,7 @@
|
||||||
return {...state, culture: pack.cells.culture[state.center]};
|
return {...state, culture: pack.cells.culture[state.center]};
|
||||||
});
|
});
|
||||||
|
|
||||||
console.timeEnd('resetCulturesForBurgsAndStates');
|
console.timeEnd('updateCulturesForBurgsAndStates');
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate and draw curved state labels for a list of states
|
// calculate and draw curved state labels for a list of states
|
||||||
|
|
@ -1053,6 +1053,6 @@
|
||||||
|
|
||||||
return {generate, expandStates, normalizeStates, assignColors,
|
return {generate, expandStates, normalizeStates, assignColors,
|
||||||
drawBurgs, specifyBurgs, defineBurgFeatures, drawStateLabels, collectStatistics,
|
drawBurgs, specifyBurgs, defineBurgFeatures, drawStateLabels, collectStatistics,
|
||||||
generateCampaigns, generateDiplomacy, defineStateForms, getFullName, generateProvinces, resetCultures};
|
generateCampaigns, generateDiplomacy, defineStateForms, getFullName, generateProvinces, updateCultures};
|
||||||
|
|
||||||
})));
|
})));
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,17 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateCultures() {
|
||||||
|
console.time('updateCulturesForReligions');
|
||||||
|
pack.religions = pack.religions.map( (religion, index) => {
|
||||||
|
if(index === 0) {
|
||||||
|
return religion;
|
||||||
|
}
|
||||||
|
return {...religion, culture: pack.cells.culture[religion.center]};
|
||||||
|
});
|
||||||
|
console.timeEnd('updateCulturesForReligions');
|
||||||
|
}
|
||||||
|
|
||||||
// assign a unique two-letters code (abbreviation)
|
// assign a unique two-letters code (abbreviation)
|
||||||
function getCode(rawName) {
|
function getCode(rawName) {
|
||||||
const name = rawName.replace("Old ", ""); // remove Old prefix
|
const name = rawName.replace("Old ", ""); // remove Old prefix
|
||||||
|
|
@ -350,6 +361,6 @@
|
||||||
return type() + " of the " + generateMeaning();
|
return type() + " of the " + generateMeaning();
|
||||||
};
|
};
|
||||||
|
|
||||||
return {generate, add, getDeityName, expandReligions};
|
return {generate, add, getDeityName, expandReligions, updateCultures};
|
||||||
|
|
||||||
})));
|
})));
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,8 @@ function regenerateReligions() {
|
||||||
function regenerateCultures() {
|
function regenerateCultures() {
|
||||||
Cultures.generate();
|
Cultures.generate();
|
||||||
Cultures.expand();
|
Cultures.expand();
|
||||||
BurgsAndStates.resetCultures();
|
BurgsAndStates.updateCultures();
|
||||||
|
Religions.updateCultures();
|
||||||
if (!layerIsOn("toggleCultures")) toggleCultures(); else drawCultures();
|
if (!layerIsOn("toggleCultures")) toggleCultures(); else drawCultures();
|
||||||
refreshAllEditors();
|
refreshAllEditors();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue