mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
fix: (v1.91.00)
This commit is contained in:
parent
dafd313395
commit
1d921c18af
11 changed files with 106 additions and 46 deletions
14
index.html
14
index.html
|
|
@ -7940,7 +7940,7 @@
|
|||
<script src="config/heightmap-templates.js"></script>
|
||||
<script src="config/precreated-heightmaps.js"></script>
|
||||
<script src="modules/heightmap-generator.js?v=1.88.00"></script>
|
||||
<script src="modules/ocean-layers.js?v=1.89.08"></script>
|
||||
<script src="modules/ocean-layers.js?v=1.91.00"></script>
|
||||
<script src="modules/river-generator.js?v=1.89.13"></script>
|
||||
<script src="modules/lakes.js"></script>
|
||||
<script src="modules/names-generator.js?v=1.87.14"></script>
|
||||
|
|
@ -7950,7 +7950,7 @@
|
|||
<script src="modules/religions-generator.js?v=1.89.36"></script>
|
||||
<script src="modules/military-generator.js"></script>
|
||||
<script src="modules/markers-generator.js?v=1.89.34"></script>
|
||||
<script src="modules/coa-generator.js?v=1.89.39"></script>
|
||||
<script src="modules/coa-generator.js?v=1.91.00"></script>
|
||||
<script src="modules/submap.js?v=1.88.05"></script>
|
||||
<script src="libs/polylabel.min.js"></script>
|
||||
<script src="libs/lineclip.min.js"></script>
|
||||
|
|
@ -7961,12 +7961,12 @@
|
|||
<script src="modules/ui/stylePresets.js?v=1.89.11"></script>
|
||||
|
||||
<script src="modules/ui/general.js?v=1.87.03"></script>
|
||||
<script src="modules/ui/options.js?v=1.90.00"></script>
|
||||
<script src="modules/ui/options.js?v=1.91.00"></script>
|
||||
<script src="main.js?v=1.90.00"></script>
|
||||
|
||||
<script defer src="modules/relief-icons.js"></script>
|
||||
<script defer src="modules/ui/style.js"></script>
|
||||
<script defer src="modules/ui/editors.js?v=1.89.35"></script>
|
||||
<script defer src="modules/ui/editors.js?v=1.91.00"></script>
|
||||
<script defer src="modules/ui/tools.js?v=1.90.00"></script>
|
||||
<script defer src="modules/ui/world-configurator.js?v=1.90.00"></script>
|
||||
<script defer src="modules/ui/heightmap-editor.js?v=1.90.04"></script>
|
||||
|
|
@ -7995,17 +7995,17 @@
|
|||
<script defer src="modules/ui/markers-overview.js?v=1.89.38"></script>
|
||||
<script defer src="modules/ui/regiment-editor.js"></script>
|
||||
<script defer src="modules/ui/battle-screen.js"></script>
|
||||
<script defer src="modules/ui/emblems-editor.js?v=1.89.21"></script>
|
||||
<script defer src="modules/ui/emblems-editor.js?v=1.91.00"></script>
|
||||
<script defer src="modules/ui/markers-editor.js"></script>
|
||||
<script defer src="modules/ui/3d.js?v=1.89.36"></script>
|
||||
<script defer src="modules/ui/submap.js"></script>
|
||||
<script defer src="modules/ui/hotkeys.js?v=1.88.00"></script>
|
||||
<script defer src="modules/coa-renderer.js?v=1.89.39"></script>
|
||||
<script defer src="modules/coa-renderer.js?v=1.91.00"></script>
|
||||
<script defer src="libs/rgbquant.min.js"></script>
|
||||
<script defer src="libs/jquery.ui.touch-punch.min.js"></script>
|
||||
|
||||
<script defer src="modules/io/save.js?v=1.90.00"></script>
|
||||
<script defer src="modules/io/load.js?v=1.90.00"></script>
|
||||
<script defer src="modules/io/load.js?v=1.91.00"></script>
|
||||
<script defer src="modules/io/cloud.js"></script>
|
||||
<script defer src="modules/io/export.js?v=1.89.36"></script>
|
||||
<script defer src="modules/io/formats.js"></script>
|
||||
|
|
|
|||
|
|
@ -1126,7 +1126,7 @@ window.COA = (function () {
|
|||
};
|
||||
|
||||
const generate = function (parent, kinship, dominion, type) {
|
||||
if (!parent || parent === "custom") {
|
||||
if (!parent || parent.custom) {
|
||||
parent = null;
|
||||
kinship = 0;
|
||||
dominion = 0;
|
||||
|
|
|
|||
|
|
@ -2023,14 +2023,8 @@ window.COArenderer = (function () {
|
|||
|
||||
// render coa if does not exist
|
||||
const trigger = async function (id, coa) {
|
||||
if (coa === "custom") {
|
||||
console.warn("Cannot render custom emblem", coa);
|
||||
return;
|
||||
}
|
||||
if (!coa) {
|
||||
console.warn(`Emblem ${id} is undefined`);
|
||||
return;
|
||||
}
|
||||
if (!coa) return console.warn(`Emblem ${id} is undefined`);
|
||||
if (coa.custom) return console.warn("Cannot render custom emblem", coa);
|
||||
if (!document.getElementById(id)) return draw(id, coa);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ async function parseLoadedData(data) {
|
|||
{
|
||||
// dynamically import and run auto-udpdate script
|
||||
const versionNumber = parseFloat(params[0]);
|
||||
const {resolveVersionConflicts} = await import("../dynamic/auto-update.js?v=1.87.08");
|
||||
const {resolveVersionConflicts} = await import("../dynamic/auto-update.js?v=1.91.00");
|
||||
resolveVersionConflicts(versionNumber);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1182,7 +1182,7 @@ async function editStates() {
|
|||
|
||||
async function editCultures() {
|
||||
if (customization) return;
|
||||
const Editor = await import("../dynamic/editors/cultures-editor.js?v=1.89.09");
|
||||
const Editor = await import("../dynamic/editors/cultures-editor.js?v=1.91.00");
|
||||
Editor.open();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,13 +112,13 @@ function editEmblem(type, id, el) {
|
|||
if (type === "burg") name = "Burg of " + name;
|
||||
document.getElementById("emblemArmiger").innerText = name;
|
||||
|
||||
if (el.coa === "custom") emblemShapeSelector.disabled = true;
|
||||
if (el.coa.custom) emblemShapeSelector.disabled = true;
|
||||
else {
|
||||
emblemShapeSelector.disabled = false;
|
||||
emblemShapeSelector.value = el.coa.shield;
|
||||
}
|
||||
|
||||
const size = el.coaSize || 1;
|
||||
const size = el.coa.size || 1;
|
||||
document.getElementById("emblemSizeSlider").value = size;
|
||||
document.getElementById("emblemSizeNumber").value = size;
|
||||
}
|
||||
|
|
@ -178,7 +178,9 @@ function editEmblem(type, id, el) {
|
|||
}
|
||||
|
||||
function changeSize() {
|
||||
const size = (el.coaSize = +this.value);
|
||||
const size = +this.value;
|
||||
el.coa.size = size;
|
||||
|
||||
document.getElementById("emblemSizeSlider").value = size;
|
||||
document.getElementById("emblemSizeNumber").value = size;
|
||||
|
||||
|
|
@ -189,8 +191,9 @@ function editEmblem(type, id, el) {
|
|||
// re-append use element
|
||||
const categotySize = +g.attr("font-size");
|
||||
const shift = (categotySize * size) / 2;
|
||||
const x = el.x || el.pole[0];
|
||||
const y = el.y || el.pole[1];
|
||||
const x = el.coa.x || el.x || el.pole[0];
|
||||
const y = el.coa.y || el.y || el.pole[1];
|
||||
|
||||
g.append("use")
|
||||
.attr("data-i", el.i)
|
||||
.attr("x", rn(x - shift), 2)
|
||||
|
|
@ -220,7 +223,7 @@ function editEmblem(type, id, el) {
|
|||
}
|
||||
|
||||
function openInArmoria() {
|
||||
const coa = el.coa && el.coa !== "custom" ? el.coa : {t1: "sable"};
|
||||
const coa = el.coa && !el.coa.custom ? el.coa : {t1: "sable"};
|
||||
const json = JSON.stringify(coa).replaceAll("#", "%23");
|
||||
const url = `https://azgaar.github.io/Armoria/?coa=${json}&from=FMG`;
|
||||
openURL(url);
|
||||
|
|
@ -281,7 +284,13 @@ function editEmblem(type, id, el) {
|
|||
defs.insertAdjacentHTML("beforeend", svg);
|
||||
|
||||
if (oldEmblem) oldEmblem.remove();
|
||||
el.coa = "custom";
|
||||
|
||||
const customCoa = {custom: true};
|
||||
if (el.coa.size) customCoa.size = el.coa.size;
|
||||
if (el.coa.x) customCoa.x = el.coa.x;
|
||||
if (el.coa.y) customCoa.y = el.coa.y;
|
||||
el.coa = customCoa;
|
||||
|
||||
emblemShapeSelector.disabled = true;
|
||||
};
|
||||
|
||||
|
|
@ -509,13 +518,21 @@ function editEmblem(type, id, el) {
|
|||
}
|
||||
|
||||
function dragEmblem() {
|
||||
const tr = parseTransform(this.getAttribute("transform"));
|
||||
const x = +tr[0] - d3.event.x,
|
||||
y = +tr[1] - d3.event.y;
|
||||
const x = Number(this.getAttribute("x")) - d3.event.x;
|
||||
const y = Number(this.getAttribute("y")) - d3.event.y;
|
||||
|
||||
d3.event.on("drag", function () {
|
||||
const transform = `translate(${x + d3.event.x},${y + d3.event.y})`;
|
||||
this.setAttribute("transform", transform);
|
||||
this.setAttribute("x", x + d3.event.x);
|
||||
this.setAttribute("y", y + d3.event.y);
|
||||
});
|
||||
|
||||
d3.event.on("end", function () {
|
||||
const categotySize = Number(this.parentNode.getAttribute("font-size"));
|
||||
const size = el.coa.size || 1;
|
||||
const shift = (categotySize * size) / 2;
|
||||
|
||||
el.coa.x = rn(x + d3.event.x + shift, 2);
|
||||
el.coa.y = rn(y + d3.event.y + shift, 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1749,9 +1749,9 @@ function drawEmblems() {
|
|||
TIME && console.time("drawEmblems");
|
||||
const {states, provinces, burgs} = pack;
|
||||
|
||||
const validStates = states.filter(s => s.i && !s.removed && s.coa && s.coaSize != 0);
|
||||
const validProvinces = provinces.filter(p => p.i && !p.removed && p.coa && p.coaSize != 0);
|
||||
const validBurgs = burgs.filter(b => b.i && !b.removed && b.coa && b.coaSize != 0);
|
||||
const validStates = states.filter(s => s.i && !s.removed && s.coa && s.coa.size !== 0);
|
||||
const validProvinces = provinces.filter(p => p.i && !p.removed && p.coa && p.coa.size !== 0);
|
||||
const validBurgs = burgs.filter(b => b.i && !b.removed && b.coa && b.coa.size !== 0);
|
||||
|
||||
const getStateEmblemsSize = () => {
|
||||
const startSize = minmax((graphHeight + graphWidth) / 40, 10, 100);
|
||||
|
|
@ -1777,26 +1777,26 @@ function drawEmblems() {
|
|||
const sizeBurgs = getBurgEmblemSize();
|
||||
const burgCOAs = validBurgs.map(burg => {
|
||||
const {x, y} = burg;
|
||||
const size = burg.coaSize || 1;
|
||||
const size = burg.coa.size || 1;
|
||||
const shift = (sizeBurgs * size) / 2;
|
||||
return {type: "burg", i: burg.i, x, y, size, shift};
|
||||
return {type: "burg", i: burg.i, x: burg.coa.x || x, y: burg.coa.y || y, size, shift};
|
||||
});
|
||||
|
||||
const sizeProvinces = getProvinceEmblemsSize();
|
||||
const provinceCOAs = validProvinces.map(province => {
|
||||
if (!province.pole) getProvincesVertices();
|
||||
const [x, y] = province.pole || pack.cells.p[province.center];
|
||||
const size = province.coaSize || 1;
|
||||
const size = province.coa.size || 1;
|
||||
const shift = (sizeProvinces * size) / 2;
|
||||
return {type: "province", i: province.i, x, y, size, shift};
|
||||
return {type: "province", i: province.i, x: province.coa.x || x, y: province.coa.y || y, size, shift};
|
||||
});
|
||||
|
||||
const sizeStates = getStateEmblemsSize();
|
||||
const stateCOAs = validStates.map(state => {
|
||||
const [x, y] = state.pole || pack.cells.p[state.center];
|
||||
const size = state.coaSize || 1;
|
||||
const size = state.coa.size || 1;
|
||||
const shift = (sizeStates * size) / 2;
|
||||
return {type: "state", i: state.i, x, y, size, shift};
|
||||
return {type: "state", i: state.i, x: state.coa.x || x, y: state.coa.y || y, size, shift};
|
||||
});
|
||||
|
||||
const nodes = burgCOAs.concat(provinceCOAs).concat(stateCOAs);
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ function changeEmblemShape(emblemShape) {
|
|||
};
|
||||
|
||||
pack.states.forEach(state => {
|
||||
if (!state.i || state.removed || !state.coa || state.coa === "custom") return;
|
||||
if (!state.i || state.removed || !state.coa || state.coa.custom) return;
|
||||
const newShield = specificShape || COA.getShield(state.culture, null);
|
||||
if (newShield === state.coa.shield) return;
|
||||
state.coa.shield = newShield;
|
||||
|
|
@ -389,7 +389,7 @@ function changeEmblemShape(emblemShape) {
|
|||
});
|
||||
|
||||
pack.provinces.forEach(province => {
|
||||
if (!province.i || province.removed || !province.coa || province.coa === "custom") return;
|
||||
if (!province.i || province.removed || !province.coa || province.coa.custom) return;
|
||||
const culture = pack.cells.culture[province.center];
|
||||
const newShield = specificShape || COA.getShield(culture, province.state);
|
||||
if (newShield === province.coa.shield) return;
|
||||
|
|
@ -398,7 +398,7 @@ function changeEmblemShape(emblemShape) {
|
|||
});
|
||||
|
||||
pack.burgs.forEach(burg => {
|
||||
if (!burg.i || burg.removed || !burg.coa || burg.coa === "custom") return;
|
||||
if (!burg.i || burg.removed || !burg.coa || burg.coa.custom) return;
|
||||
const newShield = specificShape || COA.getShield(burg.culture, burg.state);
|
||||
if (newShield === burg.coa.shield) return;
|
||||
burg.coa.shield = newShield;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
// version and caching control
|
||||
const version = "1.90.04"; // generator version, update each time
|
||||
const version = "1.91.00"; // generator version, update each time
|
||||
|
||||
{
|
||||
document.title += " v" + version;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue