Skip to content

Commit a276b61

Browse files
committed
1 parent 0ff0311 commit a276b61

File tree

5 files changed

+71
-31
lines changed

5 files changed

+71
-31
lines changed

public/modules/dynamic/auto-update.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ export function resolveVersionConflicts(mapVersion) {
253253
const source = findCell(s.x, s.y);
254254
const mouth = findCell(e.x, e.y);
255255
const name = Rivers.getName(mouth);
256-
const type = length < 25 ? rw({ Creek: 9, River: 3, Brook: 3, Stream: 1 }) : "River";
257-
pack.rivers.push({ i, parent: 0, length, source, mouth, basin: i, name, type });
256+
const type = length < 25 ? rw({Creek: 9, River: 3, Brook: 3, Stream: 1}) : "River";
257+
pack.rivers.push({i, parent: 0, length, source, mouth, basin: i, name, type});
258258
});
259259
}
260260

@@ -270,7 +270,7 @@ export function resolveVersionConflicts(mapVersion) {
270270
const era = Names.getBaseShort(P(0.7) ? 1 : rand(nameBases.length)) + " Era";
271271
const eraShort = era[0] + "E";
272272
const military = Military.getDefaultOptions();
273-
options = { winds, year, era, eraShort, military };
273+
options = {winds, year, era, eraShort, military};
274274

275275
// v1.3 added campaings data for all states
276276
States.generateCampaigns();
@@ -481,7 +481,7 @@ export function resolveVersionConflicts(mapVersion) {
481481
if (isOlderThan("1.65.0")) {
482482
// v1.65 changed rivers data
483483
d3.select("#rivers").attr("style", null); // remove style to unhide layer
484-
const { cells, rivers } = pack;
484+
const {cells, rivers} = pack;
485485
const defaultWidthFactor = rn(1 / (pointsInput.dataset.cells / 10000) ** 0.25, 2);
486486

487487
for (const river of rivers) {
@@ -497,8 +497,8 @@ export function resolveVersionConflicts(mapVersion) {
497497

498498
for (let i = 0; i <= segments; i++) {
499499
const shift = increment * i;
500-
const { x: x1, y: y1 } = node.getPointAtLength(length + shift);
501-
const { x: x2, y: y2 } = node.getPointAtLength(length - shift);
500+
const {x: x1, y: y1} = node.getPointAtLength(length + shift);
501+
const {x: x2, y: y2} = node.getPointAtLength(length - shift);
502502
const x = rn((x1 + x2) / 2, 1);
503503
const y = rn((y1 + y2) / 2, 1);
504504

@@ -565,7 +565,7 @@ export function resolveVersionConflicts(mapVersion) {
565565
const fill = circle && circle.getAttribute("fill");
566566
const stroke = circle && circle.getAttribute("stroke");
567567

568-
const marker = { i, icon, type, x, y, size, cell };
568+
const marker = {i, icon, type, x, y, size, cell};
569569
if (size && size !== 30) marker.size = size;
570570
if (!isNaN(px) && px !== 12) marker.px = px;
571571
if (!isNaN(dx) && dx !== 50) marker.dx = dx;
@@ -631,21 +631,21 @@ export function resolveVersionConflicts(mapVersion) {
631631

632632
if (isOlderThan("1.88.0")) {
633633
// v1.87 may have incorrect shield for some reason
634-
pack.states.forEach(({ coa }) => {
634+
pack.states.forEach(({coa}) => {
635635
if (coa?.shield === "state") delete coa.shield;
636636
});
637637
}
638638

639639
if (isOlderThan("1.91.0")) {
640640
// from 1.91.00 custom coa is moved to coa object
641641
pack.states.forEach(state => {
642-
if (state.coa === "custom") state.coa = { custom: true };
642+
if (state.coa === "custom") state.coa = {custom: true};
643643
});
644644
pack.provinces.forEach(province => {
645-
if (province.coa === "custom") province.coa = { custom: true };
645+
if (province.coa === "custom") province.coa = {custom: true};
646646
});
647647
pack.burgs.forEach(burg => {
648-
if (burg.coa === "custom") burg.coa = { custom: true };
648+
if (burg.coa === "custom") burg.coa = {custom: true};
649649
});
650650

651651
// from 1.91.00 emblems don't have transform attribute
@@ -747,7 +747,7 @@ export function resolveVersionConflicts(mapVersion) {
747747
const skip = terrs.attr("skip");
748748
const relax = terrs.attr("relax");
749749

750-
const curveTypes = { 0: "curveBasisClosed", 1: "curveLinear", 2: "curveStep" };
750+
const curveTypes = {0: "curveBasisClosed", 1: "curveLinear", 2: "curveStep"};
751751
const curve = curveTypes[terrs.attr("curve")] || "curveBasisClosed";
752752

753753
terrs
@@ -882,7 +882,7 @@ export function resolveVersionConflicts(mapVersion) {
882882
const secondCellId = points[1][2];
883883
const feature = pack.cells.f[secondCellId];
884884

885-
pack.routes.push({ i: pack.routes.length, group, feature, points });
885+
pack.routes.push({i: pack.routes.length, group, feature, points});
886886
}
887887
}
888888
routes.selectAll("path").remove();
@@ -914,7 +914,7 @@ export function resolveVersionConflicts(mapVersion) {
914914
const type = this.dataset.type;
915915
const color = this.getAttribute("fill");
916916
const cells = this.dataset.cells.split(",").map(Number);
917-
pack.zones.push({ i, name, type, cells, color });
917+
pack.zones.push({i, name, type, cells, color});
918918
});
919919
zones.style("display", null).selectAll("*").remove();
920920
if (layerIsOn("toggleZones")) drawZones();
@@ -975,7 +975,7 @@ export function resolveVersionConflicts(mapVersion) {
975975

976976
if (isOlderThan("1.109.0")) {
977977
// v1.109.0 added customizable burg groups and icons
978-
options.burgs = { groups: [] };
978+
options.burgs = {groups: []};
979979

980980
burgIcons.selectAll("circle, use").each(function () {
981981
const group = this.parentNode.id;
@@ -987,7 +987,7 @@ export function resolveVersionConflicts(mapVersion) {
987987
burgIcons.selectAll("g").each(function (_el, index) {
988988
const name = this.id;
989989
const isDefault = name === "towns";
990-
options.burgs.groups.push({ name, active: true, order: index + 1, isDefault, preview: "watabou-city" });
990+
options.burgs.groups.push({name, active: true, order: index + 1, isDefault, preview: "watabou-city"});
991991
if (!this.dataset.icon) this.dataset.icon = "#icon-circle";
992992

993993
const size = Number(this.getAttribute("size") || 2) * 2;
@@ -1104,6 +1104,12 @@ export function resolveVersionConflicts(mapVersion) {
11041104
// Re-render ice from migrated data
11051105
if (layerIsOn("toggleIce")) drawIce();
11061106
}
1107+
}
11071108

1109+
if (isOlderThan("1.113.0")) {
1110+
// v1.113.0 fixed issue with zone.cells getting rediculously long
1111+
pack.zones.forEach(zone => {
1112+
zone.cells = unique(zone.cells);
1113+
});
11081114
}
11091115
}

public/modules/io/load.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ async function parseLoadedData(data, mapVersion) {
473473

474474
{
475475
// dynamically import and run auto-update script
476-
const {resolveVersionConflicts} = await import("../dynamic/auto-update.js?v=1.109.4");
476+
const {resolveVersionConflicts} = await import("../dynamic/auto-update.js?v=1.113.0");
477477
resolveVersionConflicts(mapVersion);
478478
}
479479

public/modules/ui/heightmap-editor.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,12 @@ function editHeightmap(options) {
330330
c.y = p[1];
331331
}
332332

333+
// save zone grid cells to restore them later
333334
const zoneGridCellsMap = new Map();
334335
for (const zone of pack.zones) {
335-
if (!zone.cells || !zone.cells.length) continue;
336-
zoneGridCellsMap.set(zone.i, zone.cells.map(i => pack.cells.g[i]));
336+
if (!zone.cells?.length) continue;
337+
const zoneGridCells = zone.cells.map(i => pack.cells.g[i]);
338+
zoneGridCellsMap.set(zone.i, unique(zoneGridCells));
337339
}
338340

339341
Features.markupGrid();
@@ -451,10 +453,15 @@ function editHeightmap(options) {
451453
gridToPackMap.get(g).push(i);
452454
}
453455

456+
// restore zone cells
454457
for (const zone of pack.zones) {
455458
const gridCells = zoneGridCellsMap.get(zone.i);
456-
if (!gridCells || !gridCells.length) continue;
457-
zone.cells = gridCells.flatMap(g => gridToPackMap.get(g) || []);
459+
if (gridCells?.length) {
460+
const packCells = gridCells.flatMap(g => gridToPackMap.get(g) || []);
461+
zone.cells = unique(packCells);
462+
} else {
463+
zone.cells = [];
464+
}
458465
}
459466

460467
// recalculate ice
@@ -665,7 +672,10 @@ function editHeightmap(options) {
665672
if (power === 0) return tip("Power should not be zero", false, "error");
666673

667674
const heights = grid.cells.h;
668-
const operation = power > 0 ? HeightmapGenerator.addRange.bind(HeightmapGenerator) : HeightmapGenerator.addTrough.bind(HeightmapGenerator);
675+
const operation =
676+
power > 0
677+
? HeightmapGenerator.addRange.bind(HeightmapGenerator)
678+
: HeightmapGenerator.addTrough.bind(HeightmapGenerator);
669679
HeightmapGenerator.setGraph(grid);
670680
operation("1", String(Math.abs(power)), null, null, fromCell, toCell);
671681
const changedHeights = HeightmapGenerator.getHeights();

public/versioning.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
1414
*/
1515

16-
const VERSION = "1.112.4";
16+
const VERSION = "1.113.0";
1717
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
1818

1919
{

src/index.html

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
@@ -138,13 +138,32 @@
138138
}
139139
</style>
140140

141-
<link rel="preload" href="index.css?v=1.109.1" as="style" onload="this.onload=null; this.rel='stylesheet'" />
142-
<link rel="preload" href="icons.css" as="style" onload="this.onload=null; this.rel='stylesheet'" />
141+
<link
142+
rel="preload"
143+
href="index.css?v=1.109.1"
144+
as="style"
145+
onload="
146+
this.onload = null;
147+
this.rel = 'stylesheet';
148+
"
149+
/>
150+
<link
151+
rel="preload"
152+
href="icons.css"
153+
as="style"
154+
onload="
155+
this.onload = null;
156+
this.rel = 'stylesheet';
157+
"
158+
/>
143159
<link
144160
rel="preload"
145161
href="libs/jquery-ui.css?v=1.106.5"
146162
as="style"
147-
onload="this.onload=null; this.rel='stylesheet'"
163+
onload="
164+
this.onload = null;
165+
this.rel = 'stylesheet';
166+
"
148167
/>
149168
</head>
150169
<body>
@@ -4289,7 +4308,9 @@
42894308
id="templateCA"
42904309
data-tip="Find or share custom template on Cartography Assets portal"
42914310
class="icon-drafting-compass"
4292-
onclick="openURL('https://cartographyassets.com/asset-category/specific-assets/azgaars-generator/templates')"
4311+
onclick="
4312+
openURL('https://cartographyassets.com/asset-category/specific-assets/azgaars-generator/templates')
4313+
"
42934314
></button>
42944315
<button
42954316
id="templateTutorial"
@@ -6120,7 +6141,10 @@
61206141
id="showLabels"
61216142
class="checkbox"
61226143
type="checkbox"
6123-
onchange="hideLabels.checked = !this.checked; invokeActiveZooming()"
6144+
onchange="
6145+
hideLabels.checked = !this.checked;
6146+
invokeActiveZooming();
6147+
"
61246148
checked=""
61256149
/>
61266150
<label for="showLabels" class="checkbox-label">Show all labels</label>
@@ -8512,7 +8536,7 @@
85128536
<script defer src="modules/ui/editors.js?v=1.112.1"></script>
85138537
<script defer src="modules/ui/tools.js?v=1.111.0"></script>
85148538
<script defer src="modules/ui/world-configurator.js?v=1.105.4"></script>
8515-
<script defer src="modules/ui/heightmap-editor.js?v=1.112.2"></script>
8539+
<script defer src="modules/ui/heightmap-editor.js?v=1.113.0"></script>
85168540
<script defer src="modules/ui/provinces-editor.js?v=1.108.1"></script>
85178541
<script defer src="modules/ui/biomes-editor.js?v=1.112.0"></script>
85188542
<script defer src="modules/ui/namesbase-editor.js?v=1.105.11"></script>
@@ -8552,7 +8576,7 @@
85528576
<script defer src="libs/rgbquant.min.js"></script>
85538577
<script defer src="libs/jquery.ui.touch-punch.min.js"></script>
85548578
<script defer src="modules/io/save.js?v=1.111.0"></script>
8555-
<script defer src="modules/io/load.js?v=1.111.0"></script>
8579+
<script defer src="modules/io/load.js?v=1.113.0"></script>
85568580
<script defer src="modules/io/cloud.js?v=1.106.0"></script>
85578581
<script defer src="modules/io/export.js?v=1.112.2"></script>
85588582
</body>

0 commit comments

Comments
 (0)