refactor: split states and burgs generators

This commit is contained in:
Azgaar 2024-09-29 14:24:44 +02:00
parent e53c3a7773
commit d7d79ad740
18 changed files with 445 additions and 358 deletions

View file

@ -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()
};
}
}