mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
fix: 1.103.02 - parse old .map - markers data fix
This commit is contained in:
parent
637aa398bb
commit
0b8d3c63fc
4 changed files with 7 additions and 5 deletions
|
|
@ -114,7 +114,7 @@ function uploadMap(file, callback) {
|
|||
|
||||
const isInvalid = !mapData || !isValidVersion(mapVersion) || mapData.length < 26 || !mapData[5];
|
||||
const isUpdated = compareVersions(mapVersion, VERSION).isEqual;
|
||||
const isAncient = compareVersions(mapVersion, "0.7.0").isOlder;
|
||||
const isAncient = compareVersions(mapVersion, "0.70.0").isOlder;
|
||||
const isNewer = compareVersions(mapVersion, VERSION).isNewer;
|
||||
const isOutdated = compareVersions(mapVersion, VERSION).isOlder;
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ async function parseLoadedResult(result) {
|
|||
|
||||
const mapData = decoded.split("\r\n");
|
||||
const mapVersionString = mapData[0].split("|")[0] || mapData[0] || "";
|
||||
const [major, minor, patch = "00"] = mapVersionString.split(".");
|
||||
const [major, minor, patch = 0] = mapVersionString.split(".").map(parseFloat);
|
||||
const mapVersion = `${major}.${minor}.${patch}`;
|
||||
|
||||
return [mapData, mapVersion];
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ window.Markers = (function () {
|
|||
while (quantity && candidates.length) {
|
||||
const [cell] = extractAnyElement(candidates);
|
||||
const marker = addMarker({icon, type, dx, dy, px}, {cell});
|
||||
if (!marker) continue;
|
||||
add("marker" + marker.i, cell);
|
||||
quantity--;
|
||||
}
|
||||
|
|
@ -150,6 +151,7 @@ window.Markers = (function () {
|
|||
}
|
||||
|
||||
function addMarker(base, marker) {
|
||||
if (marker.cell === undefined) return;
|
||||
const i = last(pack.markers)?.i + 1 || 0;
|
||||
const [x, y] = getMarkerCoordinates(marker.cell);
|
||||
marker = {...base, x, y, ...marker, i};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue