mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-19 10:31:24 +01:00
feat: Update version and use constant for VERSION in multiple files
This commit is contained in:
parent
5fd55f3f9c
commit
5ec682562b
8 changed files with 31 additions and 32 deletions
|
|
@ -72,7 +72,7 @@ function getGridDataJson() {
|
|||
|
||||
function getMapInfo() {
|
||||
return {
|
||||
version,
|
||||
version: VERSION,
|
||||
description: "Azgaar's Fantasy Map Generator output: azgaar.github.io/Fantasy-map-generator",
|
||||
exportedAt: new Date().toISOString(),
|
||||
mapName: mapName.value,
|
||||
|
|
|
|||
|
|
@ -113,10 +113,10 @@ function uploadMap(file, callback) {
|
|||
const [mapData, mapVersion] = await parseLoadedResult(result);
|
||||
|
||||
const isInvalid = !mapData || !isValidVersion(mapVersion) || mapData.length < 26 || !mapData[5];
|
||||
const isUpdated = compareVersions(mapVersion, version).isEqual;
|
||||
const isUpdated = compareVersions(mapVersion, VERSION).isEqual;
|
||||
const isAncient = compareVersions(mapVersion, "0.7.0").isOlder;
|
||||
const isNewer = compareVersions(mapVersion, version).isNewer;
|
||||
const isOutdated = compareVersions(mapVersion, version).isOlder;
|
||||
const isNewer = compareVersions(mapVersion, VERSION).isNewer;
|
||||
const isOutdated = compareVersions(mapVersion, VERSION).isOlder;
|
||||
|
||||
if (isInvalid) return showUploadMessage("invalid", mapData, mapVersion);
|
||||
if (isUpdated) return showUploadMessage("updated", mapData, mapVersion);
|
||||
|
|
@ -181,7 +181,7 @@ function showUploadMessage(type, mapData, mapVersion) {
|
|||
message = `The map version you are trying to load (${mapVersion}) is newer than the current version.<br>Please load the file in the appropriate version`;
|
||||
title = "Newer file";
|
||||
} else if (type === "outdated") {
|
||||
INFO && console.info(`Loading map. Auto-updating from ${mapVersion} to ${version}`);
|
||||
INFO && console.info(`Loading map. Auto-updating from ${mapVersion} to ${VERSION}`);
|
||||
parseLoadedData(mapData, mapVersion);
|
||||
return;
|
||||
}
|
||||
|
|
@ -707,7 +707,7 @@ async function parseLoadedData(data, mapVersion) {
|
|||
ERROR && console.error(error);
|
||||
clearMainTip();
|
||||
|
||||
alertMessage.innerHTML = /* html */ `An error is occured on map loading. Select a different file to load, <br>generate a new random map or cancel the loading.<br>Map version: ${mapVersion}. Generator version: ${version}.
|
||||
alertMessage.innerHTML = /* html */ `An error is occured on map loading. Select a different file to load, <br>generate a new random map or cancel the loading.<br>Map version: ${mapVersion}. Generator version: ${VERSION}.
|
||||
<p id="errorBox">${parseError(error)}</p>`;
|
||||
|
||||
$("#alert").dialog({
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ function prepareMapData() {
|
|||
const date = new Date();
|
||||
const dateString = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
|
||||
const license = "File can be loaded in azgaar.github.io/Fantasy-Map-Generator";
|
||||
const params = [version, license, dateString, seed, graphWidth, graphHeight, mapId].join("|");
|
||||
const params = [VERSION, license, dateString, seed, graphWidth, graphHeight, mapId].join("|");
|
||||
const settings = [
|
||||
distanceUnitInput.value,
|
||||
distanceScale,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ async function getStylePreset(desiredPreset) {
|
|||
|
||||
async function fetchSystemPreset(preset) {
|
||||
try {
|
||||
const res = await fetch(`./styles/${preset}.json?v=${version}`);
|
||||
const res = await fetch(`./styles/${preset}.json?v=${VERSION}`);
|
||||
return await res.json();
|
||||
} catch (err) {
|
||||
throw new Error("Cannot fetch style preset", preset);
|
||||
|
|
|
|||
|
|
@ -159,18 +159,6 @@ window.UISubmap = (function () {
|
|||
return canvas;
|
||||
}
|
||||
|
||||
// currently unused alternative to PNG version
|
||||
async function loadPreviewSVG($container, w, h) {
|
||||
$container.innerHTML = /*html*/ `
|
||||
<svg id="submapPreviewSVG" viewBox="0 0 ${graphWidth} ${graphHeight}">
|
||||
<rect width="100%" height="100%" fill="${byId("styleOceanFill").value}" />
|
||||
<rect fill="url(#oceanic)" width="100%" height="100%" />
|
||||
<use href="#map"></use>
|
||||
</svg>
|
||||
`;
|
||||
return byId("submapPreviewSVG");
|
||||
}
|
||||
|
||||
// Resample the whole map to different cell resolution or shape
|
||||
const resampleCurrentMap = debounce(function () {
|
||||
WARN && console.warn("Resampling current map");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue