mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-04 17:41:23 +01:00
feat: migrate ice data to new data model and update version to 1.110.0
This commit is contained in:
parent
7f99323d22
commit
b1a8c042e6
3 changed files with 75 additions and 8 deletions
|
|
@ -1036,4 +1036,69 @@ export function resolveVersionConflicts(mapVersion) {
|
|||
delete options.showMFCGMap;
|
||||
delete options.villageMaxPopulation;
|
||||
}
|
||||
|
||||
if (isOlderThan("1.110.0")) {
|
||||
// v1.110.0 moved ice data from SVG to data model
|
||||
// Migrate old ice SVG elements to new pack.ice structure
|
||||
if (!pack.ice) pack.ice = { glaciers: [], icebergs: [] };
|
||||
|
||||
const iceLayer = document.getElementById("ice");
|
||||
if (iceLayer) {
|
||||
// Migrate glaciers (type="iceShield")
|
||||
iceLayer.querySelectorAll("polygon[type='iceShield']").forEach(polygon => {
|
||||
const pointsStr = polygon.getAttribute("points");
|
||||
if (!pointsStr) return;
|
||||
|
||||
// Parse points string "x1,y1 x2,y2 x3,y3 ..." into array [[x1,y1], [x2,y2], ...]
|
||||
const points = pointsStr
|
||||
.split(" ")
|
||||
.map(pair => pair.split(",").map(Number));
|
||||
|
||||
const transform = polygon.getAttribute("transform");
|
||||
const offset = transform ? parseTransform(transform) : null;
|
||||
pack.ice.glaciers.push({
|
||||
points,
|
||||
offset
|
||||
});
|
||||
});
|
||||
|
||||
// Migrate icebergs
|
||||
iceLayer.querySelectorAll("polygon:not([type])").forEach(polygon => {
|
||||
const pointsStr = polygon.getAttribute("points");
|
||||
const cellId = +polygon.getAttribute("cell");
|
||||
const size = +polygon.getAttribute("size");
|
||||
|
||||
if (!pointsStr || !cellId || !size) return;
|
||||
|
||||
// Parse points string "x1,y1 x2,y2 x3,y3 ..." into array [[x1,y1], [x2,y2], ...]
|
||||
const points = pointsStr
|
||||
.split(" ")
|
||||
.map(pair => pair.split(",").map(Number));
|
||||
|
||||
const transform = polygon.getAttribute("transform");
|
||||
const offset = transform ? parseTransform(transform) : null;
|
||||
pack.ice.icebergs.push({
|
||||
cellId,
|
||||
size,
|
||||
points,
|
||||
offset
|
||||
});
|
||||
});
|
||||
|
||||
// Clear old SVG elements - use d3 selection
|
||||
d3.select(iceLayer).selectAll("*").remove();
|
||||
} else {
|
||||
// If ice layer element doesn't exist, create it
|
||||
ice = viewbox.insert("g", "#coastline").attr("id", "ice");
|
||||
ice
|
||||
.attr("opacity", null)
|
||||
.attr("fill", "#e8f0f6")
|
||||
.attr("stroke", "#e8f0f6")
|
||||
.attr("stroke-width", 1)
|
||||
.attr("filter", "url(#dropShadow05)");
|
||||
}
|
||||
|
||||
// Re-render ice from migrated data
|
||||
if (layerIsOn("toggleIce")) drawIce();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ function drawIce() {
|
|||
.attr("points", glacier.points)
|
||||
.attr("type", "iceShield")
|
||||
.attr("data-index", index)
|
||||
.attr("transform", glacier.offset ? `translate(${glacier.offset[0]},${glacier.offset[1]})` : null)
|
||||
.attr("class", "glacier");
|
||||
});
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ function drawIce() {
|
|||
.attr("cell", iceberg.cellId)
|
||||
.attr("size", iceberg.size)
|
||||
.attr("data-index", index)
|
||||
.attr("transform", iceberg.offset ? `translate(${iceberg.offset[0]},${iceberg.offset[1]})` : null)
|
||||
.attr("class", "iceberg");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8500,7 +8500,7 @@
|
|||
<script src="modules/river-generator.js?v=1.106.7"></script>
|
||||
<script src="modules/lakes.js?v=1.99.00"></script>
|
||||
<script src="modules/biomes.js?v=1.99.00"></script>
|
||||
<script src="modules/ice.js?v=1.109.6"></script>
|
||||
<script src="modules/ice.js?v=1.110.0"></script>
|
||||
<script src="modules/names-generator.js?v=1.106.0"></script>
|
||||
<script src="modules/cultures-generator.js?v=1.106.0"></script>
|
||||
<script src="modules/burgs-generator.js?v=1.109.5"></script>
|
||||
|
|
@ -8518,16 +8518,16 @@
|
|||
<script src="libs/lineclip.min.js?v1.105.0"></script>
|
||||
<script src="libs/simplify.js?v1.105.6"></script>
|
||||
<script src="modules/fonts.js?v=1.99.03"></script>
|
||||
<script src="modules/ui/layers.js?v=1.109.6"></script>
|
||||
<script src="modules/ui/layers.js?v=1.110.0"></script>
|
||||
<script src="modules/ui/measurers.js?v=1.99.00"></script>
|
||||
<script src="modules/ui/style-presets.js?v=1.100.00"></script>
|
||||
<script src="modules/ui/general.js?v=1.100.00"></script>
|
||||
<script src="modules/ui/options.js?v=1.106.2"></script>
|
||||
<script src="main.js?v=1.109.6"></script>
|
||||
<script src="main.js?v=1.110.0"></script>
|
||||
|
||||
<script defer src="modules/ui/style.js?v=1.108.4"></script>
|
||||
<script defer src="modules/ui/editors.js?v=1.108.5"></script>
|
||||
<script defer src="modules/ui/tools.js?v=1.109.6"></script>
|
||||
<script defer src="modules/ui/tools.js?v=1.110.0"></script>
|
||||
<script defer src="modules/ui/world-configurator.js?v=1.105.4"></script>
|
||||
<script defer src="modules/ui/heightmap-editor.js?v=1.105.2"></script>
|
||||
<script defer src="modules/ui/provinces-editor.js?v=1.108.1"></script>
|
||||
|
|
@ -8538,7 +8538,7 @@
|
|||
<script defer src="modules/ui/routes-editor.js?v=1.104.3"></script>
|
||||
<script defer src="modules/ui/routes-creator.js?v=1.104.3"></script>
|
||||
<script defer src="modules/ui/route-group-editor.js?v=1.103.8"></script>
|
||||
<script defer src="modules/ui/ice-editor.js?v=1.109.6"></script>
|
||||
<script defer src="modules/ui/ice-editor.js?v=1.110.0"></script>
|
||||
<script defer src="modules/ui/lakes-editor.js?v=1.106.0"></script>
|
||||
<script defer src="modules/ui/coastline-editor.js?v=1.99.00"></script>
|
||||
<script defer src="modules/ui/labels-editor.js?v=1.106.0"></script>
|
||||
|
|
@ -8569,8 +8569,8 @@
|
|||
<script defer src="modules/coa-renderer.js?v=1.99.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.109.6"></script>
|
||||
<script defer src="modules/io/load.js?v=1.109.6"></script>
|
||||
<script defer src="modules/io/save.js?v=1.110.0"></script>
|
||||
<script defer src="modules/io/load.js?v=1.110.0"></script>
|
||||
<script defer src="modules/io/cloud.js?v=1.106.0"></script>
|
||||
<script defer src="modules/io/export.js?v=1.108.13"></script>
|
||||
|
||||
|
|
@ -8586,6 +8586,6 @@
|
|||
<script defer src="modules/renderers/draw-burg-labels.js?v=1.109.4"></script>
|
||||
<script defer src="modules/renderers/draw-burg-icons.js?v=1.109.4"></script>
|
||||
<script defer src="modules/renderers/draw-relief-icons.js?v=1.108.4"></script>
|
||||
<script defer src="modules/renderers/draw-ice.js?v=1.109.6"></script>
|
||||
<script defer src="modules/renderers/draw-ice.js?v=1.110.0"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue