mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
refactor: split states and burgs generators
This commit is contained in:
parent
e53c3a7773
commit
d7d79ad740
18 changed files with 445 additions and 358 deletions
|
|
@ -47,10 +47,10 @@ export function resolveVersionConflicts(mapVersion) {
|
|||
|
||||
// v1.0 added state relations, provinces, forms and full names
|
||||
provs = viewbox.insert("g", "#borders").attr("id", "provs").attr("opacity", 0.6);
|
||||
BurgsAndStates.collectStatistics();
|
||||
BurgsAndStates.generateCampaigns();
|
||||
BurgsAndStates.generateDiplomacy();
|
||||
BurgsAndStates.defineStateForms();
|
||||
States.collectStatistics();
|
||||
States.generateCampaigns();
|
||||
States.generateDiplomacy();
|
||||
States.defineStateForms();
|
||||
Provinces.generate();
|
||||
Provinces.getPoles();
|
||||
if (!layerIsOn("toggleBorders")) $("#borders").fadeOut();
|
||||
|
|
@ -260,7 +260,7 @@ export function resolveVersionConflicts(mapVersion) {
|
|||
|
||||
if (isOlderThan("1.22.0")) {
|
||||
// v1.22 changed state neighbors from Set object to array
|
||||
BurgsAndStates.collectStatistics();
|
||||
States.collectStatistics();
|
||||
}
|
||||
|
||||
if (isOlderThan("1.3.0")) {
|
||||
|
|
@ -273,7 +273,7 @@ export function resolveVersionConflicts(mapVersion) {
|
|||
options = {winds, year, era, eraShort, military};
|
||||
|
||||
// v1.3 added campaings data for all states
|
||||
BurgsAndStates.generateCampaigns();
|
||||
States.generateCampaigns();
|
||||
|
||||
// v1.3 added militry layer
|
||||
armies = viewbox.insert("g", "#icons").attr("id", "armies");
|
||||
|
|
@ -348,7 +348,7 @@ export function resolveVersionConflicts(mapVersion) {
|
|||
// v1.5 added burg type value
|
||||
pack.burgs.forEach(burg => {
|
||||
if (!burg.i || burg.removed) return;
|
||||
burg.type = BurgsAndStates.getType(burg.cell, burg.port);
|
||||
burg.type = Burgs.getType(burg.cell, burg.port);
|
||||
});
|
||||
|
||||
// v1.5 added emblems
|
||||
|
|
@ -944,7 +944,7 @@ export function resolveVersionConflicts(mapVersion) {
|
|||
|
||||
if (isOlderThan("1.104.0")) {
|
||||
// v1.104.00 separated pole of inaccessibility detection from layer rendering
|
||||
BurgsAndStates.getPoles();
|
||||
States.getPoles();
|
||||
Provinces.getPoles();
|
||||
}
|
||||
|
||||
|
|
@ -967,5 +967,9 @@ export function resolveVersionConflicts(mapVersion) {
|
|||
|
||||
// v1.106.0 change burg groups and added customizable icons
|
||||
icons.selectAll("circle, use").remove();
|
||||
|
||||
options.burgs = {
|
||||
groups: States.getDefaultGroups()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ function addListeners() {
|
|||
}
|
||||
|
||||
function refreshStatesEditor() {
|
||||
BurgsAndStates.collectStatistics();
|
||||
States.collectStatistics();
|
||||
statesEditorAddLines();
|
||||
}
|
||||
|
||||
|
|
@ -839,10 +839,10 @@ function openRegenerationMenu() {
|
|||
function recalculateStates(must) {
|
||||
if (!must && !statesAutoChange.checked) return;
|
||||
|
||||
BurgsAndStates.expandStates();
|
||||
States.expandStates();
|
||||
Provinces.generate();
|
||||
Provinces.getPoles();
|
||||
BurgsAndStates.getPoles();
|
||||
States.getPoles();
|
||||
|
||||
if (layerIsOn("toggleStates")) drawStates();
|
||||
if (layerIsOn("toggleBorders")) drawBorders();
|
||||
|
|
@ -984,7 +984,7 @@ function applyStatesManualAssignent() {
|
|||
|
||||
if (affectedStates.length) {
|
||||
refreshStatesEditor();
|
||||
BurgsAndStates.getPoles();
|
||||
States.getPoles();
|
||||
layerIsOn("toggleStates") ? drawStates() : toggleStates();
|
||||
if (adjustLabels.checked) drawStateLabels([...new Set(affectedStates)]);
|
||||
adjustProvinces([...new Set(affectedProvinces)]);
|
||||
|
|
@ -1102,7 +1102,7 @@ function adjustProvinces(affectedProvinces) {
|
|||
const color = getMixedColor(states[stateId].color);
|
||||
|
||||
const kinship = nameByBurg ? 0.8 : 0.4;
|
||||
const type = BurgsAndStates.getType(center, burg?.port);
|
||||
const type = Burgs.getType(center, burg?.port);
|
||||
const coa = COA.generate(burg?.coa || states[stateId].coa, kinship, burg ? null : 0.9, type);
|
||||
coa.shield = COA.getShield(culture, stateId);
|
||||
|
||||
|
|
@ -1253,8 +1253,8 @@ function addState() {
|
|||
coa,
|
||||
pole
|
||||
});
|
||||
BurgsAndStates.collectStatistics();
|
||||
BurgsAndStates.defineStateForms([newState]);
|
||||
States.collectStatistics();
|
||||
States.defineStateForms([newState]);
|
||||
adjustProvinces([cells.province[center]]);
|
||||
|
||||
if (layerIsOn("toggleProvinces")) toggleProvinces();
|
||||
|
|
@ -1419,7 +1419,7 @@ function openStateMergeDialog() {
|
|||
unfog();
|
||||
debug.selectAll(".highlight").remove();
|
||||
|
||||
BurgsAndStates.getPoles();
|
||||
States.getPoles();
|
||||
layerIsOn("toggleStates") ? drawStates() : toggleStates();
|
||||
layerIsOn("toggleBorders") ? drawBorders() : toggleBorders();
|
||||
layerIsOn("toggleProvinces") && drawProvinces();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue