mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 15:33:12 +09:00
Break out version to integer functions
Move the multiple implementation of version to integers calculation to dedicated functions in one place.
This commit is contained in:
1 parent
af79e2abbd
commit
7d34c60dd1
3 files changed
+41
-6
No files matched your search
@@ -3,6 +3,8 @@ const zlib = require("zlib");
|
||||
|
||||
const libSchema = require("../schema");
|
||||
|
||||
const { integerFactorioVersion } = require("./version");
|
||||
|
||||
|
||||
/**
|
||||
* A setting for a mod.
|
||||
@@ -77,8 +79,7 @@ class ModPack {
|
||||
* @type {number}
|
||||
*/
|
||||
get integerFactorioVersion() {
|
||||
const [major, minor, sub] = this.factorioVersion.split(".").map(n => Number.parseInt(n, 10));
|
||||
return major * 0x100000000 + minor * 0x10000 + (sub || 0); // Can't use bitwise here because this is 48-bits.
|
||||
return integerFactorioVersion(this.factorioVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user