From: Aaron Traas Date: Sun, 2 Jul 2017 06:02:09 +0000 (-0400) Subject: centralize calls to make_zzword() X-Git-Tag: takebird~124 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=85f8334e17b9e3118a73f2e9405e9db5f94ad648;hp=be115e95678fd352c1a6ad5862c8d9b4fe56ddaf centralize calls to make_zzword() make_zzword() now called in set_seed(), because the only times it was called in the entire application is after every invocation of set_seed(). --- diff --git a/init.c b/init.c index 0f81fe1..812e943 100644 --- a/init.c +++ b/init.c @@ -92,8 +92,5 @@ long initialise(void) } game.conds = setbit(11); - /* Start-up, dwarf stuff */ - make_zzword(game.zzword); - return seedval; } diff --git a/main.c b/main.c index 9d466b4..1cff0d1 100644 --- a/main.c +++ b/main.c @@ -141,8 +141,6 @@ static bool fallback_handler(char *buf) printf("Seed set to %ld\n", sv); // autogenerated, so don't charge user time for it. --game.turns; - // here we reconfigure any global game state that uses random numbers - make_zzword(game.zzword); return true; } return false; diff --git a/misc.c b/misc.c index ac22ae0..b71969e 100644 --- a/misc.c +++ b/misc.c @@ -633,8 +633,8 @@ long atdwrf(long where) return (at); } -/* Utility routines (SETBIT, TSTBIT, set_seed, get_next_lcg_value, - * randrange, RNDVOC) */ +/* Utility routines (setbit, tstbit, set_seed, get_next_lcg_value, + * randrange) */ long setbit(long bit) /* Returns 2**bit for use in constructing bit-masks. */ @@ -652,6 +652,9 @@ void set_seed(long seedval) /* Set the LCG seed */ { game.lcg_x = (unsigned long) seedval % game.lcg_m; + + // once seed is set, we need to generate the Z`ZZZ word + make_zzword(game.zzword); } unsigned long get_next_lcg_value(void) diff --git a/saveresume.c b/saveresume.c index c275986..49e0021 100644 --- a/saveresume.c +++ b/saveresume.c @@ -122,8 +122,6 @@ int restore(FILE* fp) rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10)); } else { memcpy(&game, &save.game, sizeof(struct game_t)); - //game.zzword = rndvoc(3, game.zzword); - make_zzword(game.zzword); } return GO_TOP; }