mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
fix: version detection on load
This commit is contained in:
parent
0b8d3c63fc
commit
dd35947ecd
2 changed files with 37 additions and 17 deletions
|
|
@ -7,12 +7,13 @@
|
|||
*
|
||||
* Update the version MANUALLY on each merge to main:
|
||||
* 1. MAJOR version: Incompatible changes that break existing maps
|
||||
* 2. MINOR version: Backwards-compatible changes requiring old .map files to be updated
|
||||
* 3. PATCH version: Backwards-compatible bug fixes not affecting .map file format
|
||||
* 2. MINOR version: Additions or changes that are backward-compatible but may require old .map files to be updated
|
||||
* 3. PATCH version: Backward-compatible bug fixes and small features that do not affect the .map file format
|
||||
*
|
||||
* Example: 1.102.0 -> Major version 1, Minor version 102, Patch version 0
|
||||
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
|
||||
*/
|
||||
const VERSION = "1.103.02";
|
||||
const VERSION = "1.103.3";
|
||||
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
|
||||
|
||||
{
|
||||
document.title += " v" + VERSION;
|
||||
|
|
@ -80,6 +81,23 @@ const VERSION = "1.103.02";
|
|||
}
|
||||
}
|
||||
|
||||
function parseMapVersion(version) {
|
||||
let [major, minor, patch] = version.split(".");
|
||||
|
||||
if (patch === undefined) {
|
||||
// e.g. 1.732
|
||||
minor = minor.slice(0, 2);
|
||||
patch = minor.slice(2);
|
||||
}
|
||||
|
||||
// e.g. 0.7b
|
||||
major = parseInt(major) || 0;
|
||||
minor = parseInt(minor) || 0;
|
||||
patch = parseInt(patch) || 0;
|
||||
|
||||
return `${major}.${minor}.${patch}`;
|
||||
}
|
||||
|
||||
function isValidVersion(versionString) {
|
||||
if (!versionString) return false;
|
||||
const [major, minor, patch] = versionString.split(".");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue