mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-19 10:31:24 +01:00
refactor: generate states cleanup
This commit is contained in:
parent
c2fc0679ad
commit
ff974a4fd0
16 changed files with 98 additions and 64 deletions
|
|
@ -337,8 +337,9 @@ export function open({el}) {
|
|||
let name = "";
|
||||
if (elSelected.attr("id").slice(0, 10) === "stateLabel") {
|
||||
const id = +elSelected.attr("id").slice(10);
|
||||
const culture = pack.states[id].culture;
|
||||
name = Names.getState(Names.getCulture(culture, 4, 7, ""), culture);
|
||||
const cultureId = pack.states[id].culture;
|
||||
const base = pack.cultures[cultureId].base;
|
||||
name = Names.getState(Names.getBase(base, 4, 7, ""), base);
|
||||
} else {
|
||||
const box = elSelected.node().getBBox();
|
||||
const cell = findCell((box.x + box.width) / 2, (box.y + box.height) / 2);
|
||||
|
|
|
|||
|
|
@ -464,14 +464,15 @@ function editStateName(state) {
|
|||
|
||||
function regenerateShortNameCuture() {
|
||||
const state = +stateNameEditor.dataset.state;
|
||||
const culture = pack.states[state].culture;
|
||||
const name = Names.getState(Names.getCultureShort(culture), culture);
|
||||
const cultureId = pack.states[state].culture;
|
||||
const base = pack.cultures[cultureId].base;
|
||||
const name = Names.getState(Names.getBaseShort(base), base);
|
||||
byId("stateNameEditorShort").value = name;
|
||||
}
|
||||
|
||||
function regenerateShortNameRandom() {
|
||||
const base = rand(nameBases.length - 1);
|
||||
const name = Names.getState(Names.getBase(base), undefined, base);
|
||||
const name = Names.getState(Names.getBase(base), base);
|
||||
byId("stateNameEditorShort").value = name;
|
||||
}
|
||||
|
||||
|
|
@ -1156,7 +1157,8 @@ function adjustProvinces(affectedProvinces) {
|
|||
const culture = cells.culture[center];
|
||||
|
||||
const nameByBurg = burgCell && P(0.5);
|
||||
const name = nameByBurg ? burg.name : oldProvince.name || Names.getState(Names.getCultureShort(culture), culture);
|
||||
const base = pack.cultures[culture].base;
|
||||
const name = nameByBurg ? burg.name : oldProvince.name || Names.getState(Names.getBaseShort(base), base);
|
||||
|
||||
const formOptions = ["Zone", "Area", "Territory", "Province"];
|
||||
const formName = burgCell && oldProvince.formName ? oldProvince.formName : ra(formOptions);
|
||||
|
|
@ -1259,8 +1261,9 @@ function addState() {
|
|||
if (d3.event.shiftKey === false) exitAddStateMode();
|
||||
|
||||
const culture = cells.culture[center];
|
||||
const basename = center % 5 === 0 ? burgs[burg].name : Names.getCulture(culture);
|
||||
const name = Names.getState(basename, culture);
|
||||
const base = pack.cultures[culture].base;
|
||||
const basename = center % 5 === 0 ? burgs[burg].name : Names.getBase(culture);
|
||||
const name = Names.getState(basename, base);
|
||||
const color = getRandomColor();
|
||||
const pole = cells.p[center];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue