summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-06-23 23:30:30 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:12:42 +0100
commitb668b0ddab8ff89efd8810197b5e7c97f28db28b (patch)
treec19448b501a3712740c624fb3c9c6961a405f6c1
parentd3d8295f1be86253d294942cdfcd3ebadd24bff6 (diff)
downloadshores-of-tripoli-b668b0ddab8ff89efd8810197b5e7c97f28db28b.tar.gz
Update RNG.
-rw-r--r--rules.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index a331a05..39df702 100644
--- a/rules.js
+++ b/rules.js
@@ -266,7 +266,9 @@ const states = {};
let game = null;
function random(n) {
- return Math.floor(((game.seed = game.seed * 48271 % 0x7fffffff) / 0x7fffffff) * n);
+ if (game.rng === 1)
+ return Math.floor(((game.seed = game.seed * 48271 % 0x7fffffff) / 0x7fffffff) * n);
+ return (game.seed = game.seed * 200105 % 34359738337) % n
}
function log(...args) {
@@ -2878,6 +2880,10 @@ exports.setup = function (seed, scenario, options) {
undo: [],
};
+ // Old RNG for ancient replays
+ if (options.rng)
+ game.rng = options.rng
+
if (scenario === "Fortress Tripoli")
game.fortress = 1;