X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=misc.c;h=6ca1f876ac21a2b9e2acfaecbc09c8222acf6117;hb=6c6498b797c84653c04ef0a9fc31d52af159fdf2;hp=6f33146c2020ef74badb4ef85b8e89998fe334d7;hpb=dc6a5751ed04ff15103c9852c8dc7427298b6945;p=open-adventure.git diff --git a/misc.c b/misc.c index 6f33146..6ca1f87 100644 --- a/misc.c +++ b/misc.c @@ -460,21 +460,21 @@ bool TSTBIT(long mask, int bit) void set_seed(long seedval) /* Set the LCG seed */ { - lcgstate.x = (unsigned long) seedval % lcgstate.m; + game.lcg_x = (unsigned long) seedval % game.lcg_m; } unsigned long get_next_lcg_value(void) /* Return the LCG's current value, and then iterate it. */ { - unsigned long old_x = lcgstate.x; - lcgstate.x = (lcgstate.a * lcgstate.x + lcgstate.c) % lcgstate.m; + unsigned long old_x = game.lcg_x; + game.lcg_x = (game.lcg_a * game.lcg_x + game.lcg_c) % game.lcg_m; return old_x; } long randrange(long range) /* Return a random integer from [0, range). */ { - return range * get_next_lcg_value() / lcgstate.m; + return range * get_next_lcg_value() / game.lcg_m; } long RNDVOC(long second, long force)