mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-05 01:51:23 +01:00
just to be sure
This commit is contained in:
parent
95a06dfb4b
commit
5fc5dc700a
2 changed files with 28 additions and 28 deletions
|
|
@ -253,8 +253,8 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
const source = findCell(s.x, s.y);
|
const source = findCell(s.x, s.y);
|
||||||
const mouth = findCell(e.x, e.y);
|
const mouth = findCell(e.x, e.y);
|
||||||
const name = Rivers.getName(mouth);
|
const name = Rivers.getName(mouth);
|
||||||
const type = length < 25 ? rw({Creek: 9, River: 3, Brook: 3, Stream: 1}) : "River";
|
const type = length < 25 ? rw({ Creek: 9, River: 3, Brook: 3, Stream: 1 }) : "River";
|
||||||
pack.rivers.push({i, parent: 0, length, source, mouth, basin: i, name, type});
|
pack.rivers.push({ i, parent: 0, length, source, mouth, basin: i, name, type });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,7 +270,7 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
const era = Names.getBaseShort(P(0.7) ? 1 : rand(nameBases.length)) + " Era";
|
const era = Names.getBaseShort(P(0.7) ? 1 : rand(nameBases.length)) + " Era";
|
||||||
const eraShort = era[0] + "E";
|
const eraShort = era[0] + "E";
|
||||||
const military = Military.getDefaultOptions();
|
const military = Military.getDefaultOptions();
|
||||||
options = {winds, year, era, eraShort, military};
|
options = { winds, year, era, eraShort, military };
|
||||||
|
|
||||||
// v1.3 added campaings data for all states
|
// v1.3 added campaings data for all states
|
||||||
States.generateCampaigns();
|
States.generateCampaigns();
|
||||||
|
|
@ -481,7 +481,7 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
if (isOlderThan("1.65.0")) {
|
if (isOlderThan("1.65.0")) {
|
||||||
// v1.65 changed rivers data
|
// v1.65 changed rivers data
|
||||||
d3.select("#rivers").attr("style", null); // remove style to unhide layer
|
d3.select("#rivers").attr("style", null); // remove style to unhide layer
|
||||||
const {cells, rivers} = pack;
|
const { cells, rivers } = pack;
|
||||||
const defaultWidthFactor = rn(1 / (pointsInput.dataset.cells / 10000) ** 0.25, 2);
|
const defaultWidthFactor = rn(1 / (pointsInput.dataset.cells / 10000) ** 0.25, 2);
|
||||||
|
|
||||||
for (const river of rivers) {
|
for (const river of rivers) {
|
||||||
|
|
@ -497,8 +497,8 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
|
|
||||||
for (let i = 0; i <= segments; i++) {
|
for (let i = 0; i <= segments; i++) {
|
||||||
const shift = increment * i;
|
const shift = increment * i;
|
||||||
const {x: x1, y: y1} = node.getPointAtLength(length + shift);
|
const { x: x1, y: y1 } = node.getPointAtLength(length + shift);
|
||||||
const {x: x2, y: y2} = node.getPointAtLength(length - shift);
|
const { x: x2, y: y2 } = node.getPointAtLength(length - shift);
|
||||||
const x = rn((x1 + x2) / 2, 1);
|
const x = rn((x1 + x2) / 2, 1);
|
||||||
const y = rn((y1 + y2) / 2, 1);
|
const y = rn((y1 + y2) / 2, 1);
|
||||||
|
|
||||||
|
|
@ -565,7 +565,7 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
const fill = circle && circle.getAttribute("fill");
|
const fill = circle && circle.getAttribute("fill");
|
||||||
const stroke = circle && circle.getAttribute("stroke");
|
const stroke = circle && circle.getAttribute("stroke");
|
||||||
|
|
||||||
const marker = {i, icon, type, x, y, size, cell};
|
const marker = { i, icon, type, x, y, size, cell };
|
||||||
if (size && size !== 30) marker.size = size;
|
if (size && size !== 30) marker.size = size;
|
||||||
if (!isNaN(px) && px !== 12) marker.px = px;
|
if (!isNaN(px) && px !== 12) marker.px = px;
|
||||||
if (!isNaN(dx) && dx !== 50) marker.dx = dx;
|
if (!isNaN(dx) && dx !== 50) marker.dx = dx;
|
||||||
|
|
@ -631,7 +631,7 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
|
|
||||||
if (isOlderThan("1.88.0")) {
|
if (isOlderThan("1.88.0")) {
|
||||||
// v1.87 may have incorrect shield for some reason
|
// v1.87 may have incorrect shield for some reason
|
||||||
pack.states.forEach(({coa}) => {
|
pack.states.forEach(({ coa }) => {
|
||||||
if (coa?.shield === "state") delete coa.shield;
|
if (coa?.shield === "state") delete coa.shield;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -639,13 +639,13 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
if (isOlderThan("1.91.0")) {
|
if (isOlderThan("1.91.0")) {
|
||||||
// from 1.91.00 custom coa is moved to coa object
|
// from 1.91.00 custom coa is moved to coa object
|
||||||
pack.states.forEach(state => {
|
pack.states.forEach(state => {
|
||||||
if (state.coa === "custom") state.coa = {custom: true};
|
if (state.coa === "custom") state.coa = { custom: true };
|
||||||
});
|
});
|
||||||
pack.provinces.forEach(province => {
|
pack.provinces.forEach(province => {
|
||||||
if (province.coa === "custom") province.coa = {custom: true};
|
if (province.coa === "custom") province.coa = { custom: true };
|
||||||
});
|
});
|
||||||
pack.burgs.forEach(burg => {
|
pack.burgs.forEach(burg => {
|
||||||
if (burg.coa === "custom") burg.coa = {custom: true};
|
if (burg.coa === "custom") burg.coa = { custom: true };
|
||||||
});
|
});
|
||||||
|
|
||||||
// from 1.91.00 emblems don't have transform attribute
|
// from 1.91.00 emblems don't have transform attribute
|
||||||
|
|
@ -747,7 +747,7 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
const skip = terrs.attr("skip");
|
const skip = terrs.attr("skip");
|
||||||
const relax = terrs.attr("relax");
|
const relax = terrs.attr("relax");
|
||||||
|
|
||||||
const curveTypes = {0: "curveBasisClosed", 1: "curveLinear", 2: "curveStep"};
|
const curveTypes = { 0: "curveBasisClosed", 1: "curveLinear", 2: "curveStep" };
|
||||||
const curve = curveTypes[terrs.attr("curve")] || "curveBasisClosed";
|
const curve = curveTypes[terrs.attr("curve")] || "curveBasisClosed";
|
||||||
|
|
||||||
terrs
|
terrs
|
||||||
|
|
@ -882,7 +882,7 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
const secondCellId = points[1][2];
|
const secondCellId = points[1][2];
|
||||||
const feature = pack.cells.f[secondCellId];
|
const feature = pack.cells.f[secondCellId];
|
||||||
|
|
||||||
pack.routes.push({i: pack.routes.length, group, feature, points});
|
pack.routes.push({ i: pack.routes.length, group, feature, points });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
routes.selectAll("path").remove();
|
routes.selectAll("path").remove();
|
||||||
|
|
@ -914,7 +914,7 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
const type = this.dataset.type;
|
const type = this.dataset.type;
|
||||||
const color = this.getAttribute("fill");
|
const color = this.getAttribute("fill");
|
||||||
const cells = this.dataset.cells.split(",").map(Number);
|
const cells = this.dataset.cells.split(",").map(Number);
|
||||||
pack.zones.push({i, name, type, cells, color});
|
pack.zones.push({ i, name, type, cells, color });
|
||||||
});
|
});
|
||||||
zones.style("display", null).selectAll("*").remove();
|
zones.style("display", null).selectAll("*").remove();
|
||||||
if (layerIsOn("toggleZones")) drawZones();
|
if (layerIsOn("toggleZones")) drawZones();
|
||||||
|
|
@ -975,7 +975,7 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
|
|
||||||
if (isOlderThan("1.109.0")) {
|
if (isOlderThan("1.109.0")) {
|
||||||
// v1.109.0 added customizable burg groups and icons
|
// v1.109.0 added customizable burg groups and icons
|
||||||
options.burgs = {groups: []};
|
options.burgs = { groups: [] };
|
||||||
|
|
||||||
burgIcons.selectAll("circle, use").each(function () {
|
burgIcons.selectAll("circle, use").each(function () {
|
||||||
const group = this.parentNode.id;
|
const group = this.parentNode.id;
|
||||||
|
|
@ -987,7 +987,7 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
burgIcons.selectAll("g").each(function (_el, index) {
|
burgIcons.selectAll("g").each(function (_el, index) {
|
||||||
const name = this.id;
|
const name = this.id;
|
||||||
const isDefault = name === "towns";
|
const isDefault = name === "towns";
|
||||||
options.burgs.groups.push({name, active: true, order: index + 1, isDefault, preview: "watabou-city"});
|
options.burgs.groups.push({ name, active: true, order: index + 1, isDefault, preview: "watabou-city" });
|
||||||
if (!this.dataset.icon) this.dataset.icon = "#icon-circle";
|
if (!this.dataset.icon) this.dataset.icon = "#icon-circle";
|
||||||
|
|
||||||
const size = Number(this.getAttribute("size") || 2) * 2;
|
const size = Number(this.getAttribute("size") || 2) * 2;
|
||||||
|
|
@ -1037,20 +1037,20 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
delete options.villageMaxPopulation;
|
delete options.villageMaxPopulation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOlderThan("1.110.0")) {
|
if (isOlderThan("1.111.0")) {
|
||||||
// v1.110.0 moved ice data from SVG to data model
|
// v1.111.0 moved ice data from SVG to data model
|
||||||
// Migrate old ice SVG elements to new pack.ice structure
|
// Migrate old ice SVG elements to new pack.ice structure
|
||||||
if (!pack.ice) {
|
if (!pack.ice) {
|
||||||
pack.ice = [];
|
pack.ice = [];
|
||||||
let iceId = 0;
|
let iceId = 0;
|
||||||
|
|
||||||
const iceLayer = document.getElementById("ice");
|
const iceLayer = document.getElementById("ice");
|
||||||
if (iceLayer) {
|
if (iceLayer) {
|
||||||
// Migrate glaciers (type="iceShield")
|
// Migrate glaciers (type="iceShield")
|
||||||
iceLayer.querySelectorAll("polygon[type='iceShield']").forEach(polygon => {
|
iceLayer.querySelectorAll("polygon[type='iceShield']").forEach(polygon => {
|
||||||
// Parse points string "x1,y1 x2,y2 x3,y3 ..." into array [[x1,y1], [x2,y2], ...]
|
// Parse points string "x1,y1 x2,y2 x3,y3 ..." into array [[x1,y1], [x2,y2], ...]
|
||||||
const points = [...polygon.points].map(svgPoint => [svgPoint.x, svgPoint.y]);
|
const points = [...polygon.points].map(svgPoint => [svgPoint.x, svgPoint.y]);
|
||||||
|
|
||||||
const transform = polygon.getAttribute("transform");
|
const transform = polygon.getAttribute("transform");
|
||||||
const iceElement = {
|
const iceElement = {
|
||||||
i: iceId++,
|
i: iceId++,
|
||||||
|
|
@ -1062,18 +1062,18 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
}
|
}
|
||||||
pack.ice.push(iceElement);
|
pack.ice.push(iceElement);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Migrate icebergs
|
// Migrate icebergs
|
||||||
iceLayer.querySelectorAll("polygon:not([type])").forEach(polygon => {
|
iceLayer.querySelectorAll("polygon:not([type])").forEach(polygon => {
|
||||||
const cellId = +polygon.getAttribute("cell");
|
const cellId = +polygon.getAttribute("cell");
|
||||||
const size = +polygon.getAttribute("size");
|
const size = +polygon.getAttribute("size");
|
||||||
|
|
||||||
// points string must exist, cell attribute must be present, and size must be non-zero
|
// points string must exist, cell attribute must be present, and size must be non-zero
|
||||||
if (polygon.getAttribute("cell") === null || !size) return;
|
if (polygon.getAttribute("cell") === null || !size) return;
|
||||||
|
|
||||||
// Parse points string "x1,y1 x2,y2 x3,y3 ..." into array [[x1,y1], [x2,y2], ...]
|
// Parse points string "x1,y1 x2,y2 x3,y3 ..." into array [[x1,y1], [x2,y2], ...]
|
||||||
const points = [...polygon.points].map(svgPoint => [svgPoint.x, svgPoint.y]);
|
const points = [...polygon.points].map(svgPoint => [svgPoint.x, svgPoint.y]);
|
||||||
|
|
||||||
const transform = polygon.getAttribute("transform");
|
const transform = polygon.getAttribute("transform");
|
||||||
const iceElement = {
|
const iceElement = {
|
||||||
i: iceId++,
|
i: iceId++,
|
||||||
|
|
@ -1087,7 +1087,7 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
}
|
}
|
||||||
pack.ice.push(iceElement);
|
pack.ice.push(iceElement);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Clear old SVG elements
|
// Clear old SVG elements
|
||||||
iceLayer.querySelectorAll("*").forEach(el => el.remove());
|
iceLayer.querySelectorAll("*").forEach(el => el.remove());
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1100,10 +1100,10 @@ export function resolveVersionConflicts(mapVersion) {
|
||||||
.attr("stroke-width", 1)
|
.attr("stroke-width", 1)
|
||||||
.attr("filter", "url(#dropShadow05)");
|
.attr("filter", "url(#dropShadow05)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-render ice from migrated data
|
// Re-render ice from migrated data
|
||||||
if (layerIsOn("toggleIce")) drawIce();
|
if (layerIsOn("toggleIce")) drawIce();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
|
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const VERSION = "1.110.0";
|
const VERSION = "1.111.0";
|
||||||
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
|
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue