summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-07-24 13:04:38 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 11:54:52 +0100
commit4620136eeac88c66839bdd5aca1eb37376265c34 (patch)
treeaf2b19f23416a8b8272caf5b0aa6c21f6e4720fd /rules.js
parent10ae90c760af05516d76521f65e5d2daa71adc22 (diff)
downloadwilderness-war-4620136eeac88c66839bdd5aca1eb37376265c34.tar.gz
Update RNG.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index 61ccff5..5ac89f0 100644
--- a/rules.js
+++ b/rules.js
@@ -233,7 +233,9 @@ function abs(x) {
function random(n) {
clear_undo()
- return ((game.seed = game.seed * 69621 % 0x7fffffff) / 0x7fffffff) * n | 0
+ if (game.rng === 1)
+ return ((game.seed = game.seed * 69621 % 0x7fffffff) / 0x7fffffff) * n | 0
+ return (game.seed = game.seed * 200105 % 34359738337) % n
}
function roll_die(reason) {
@@ -9369,6 +9371,10 @@ exports.setup = function (seed, scenario, options) {
log: [],
})
+ // Old RNG for ancient replays
+ if (options.rng)
+ game.rng = options.rng
+
switch (scenario) {
default:
// fallthrough