summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-06-23 23:19:54 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:08:56 +0100
commit82b691c909a7ff46d96448ad74302fd7a21d6bca (patch)
tree32eb6cf5dd398351741e066804ea879a2e43b95f
parentd2b29dc23b9b4a4947c75a9c78acd90e26254488 (diff)
downloadjulius-caesar-82b691c909a7ff46d96448ad74302fd7a21d6bca.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 f63d66e..e186641 100644
--- a/rules.js
+++ b/rules.js
@@ -49,7 +49,9 @@ const RESERVE_MARK = ""
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 logbr() {
@@ -2564,6 +2566,10 @@ exports.setup = function (seed, scenario, options) {
reserves: [],
}
+ // Old RNG for ancient replays
+ if (options.rng)
+ game.rng = options.rng
+
if (options.tournament) {
log("Tournament rule:\nCaesar is the first player on the very first turn of the game.")
game.tournament = 1