fix: (v1.91.00)

This commit is contained in:
Azgaar 2023-08-08 15:25:28 +04:00
parent dafd313395
commit 1d921c18af
11 changed files with 106 additions and 46 deletions

View file

@ -650,4 +650,53 @@ export function resolveVersionConflicts(version) {
.attr("src", "https://i2.wp.com/azgaar.files.wordpress.com/2021/10/marble-big.jpg");
}
}
if (version < 1.91) {
// from 1.91.00 custom coa is moved to coa object
pack.states.forEach(state => {
if (state.coa === "custom") state.coa = {custom: true};
});
pack.provinces.forEach(province => {
if (province.coa === "custom") province.coa = {custom: true};
});
pack.burgs.forEach(burg => {
if (burg.coa === "custom") burg.coa = {custom: true};
});
// from 1.91.00 emblems don't have transform attribute
emblems.selectAll("use").each(function () {
const transform = this.getAttribute("transform");
if (!transform) return;
const [dx, dy] = parseTransform(transform);
const x = Number(this.getAttribute("x")) + Number(dx);
const y = Number(this.getAttribute("y")) + Number(dy);
this.setAttribute("x", x);
this.setAttribute("y", y);
this.removeAttribute("transform");
});
// from 1.91.00 coaSize is moved to coa object
pack.states.forEach(state => {
if (state.coaSize) {
state.coa.size = state.coaSize;
delete state.coaSize;
}
});
pack.provinces.forEach(province => {
if (province.coaSize) {
province.coa.size = province.coaSize;
delete province.coaSize;
}
});
pack.burgs.forEach(burg => {
if (burg.coaSize) {
burg.coa.size = burg.coaSize;
delete burg.coaSize;
}
});
}
}

View file

@ -401,7 +401,7 @@ function cultureChangeEmblemsShape() {
};
pack.states.forEach(state => {
if (state.culture !== culture || !state.i || state.removed || !state.coa || state.coa === "custom") return;
if (state.culture !== culture || !state.i || state.removed || !state.coa || state.coa.custom) return;
if (shape === state.coa.shield) return;
state.coa.shield = shape;
rerenderCOA("stateCOA" + state.i, state.coa);
@ -413,7 +413,7 @@ function cultureChangeEmblemsShape() {
!province.i ||
province.removed ||
!province.coa ||
province.coa === "custom"
province.coa.custom
)
return;
if (shape === province.coa.shield) return;
@ -422,7 +422,7 @@ function cultureChangeEmblemsShape() {
});
pack.burgs.forEach(burg => {
if (burg.culture !== culture || !burg.i || burg.removed || !burg.coa || burg.coa === "custom") return;
if (burg.culture !== culture || !burg.i || burg.removed || !burg.coa || burg.coa.custom) return;
if (shape === burg.coa.shield) return;
burg.coa.shield = shape;
rerenderCOA("burgCOA" + burg.i, burg.coa);