Include LCG state in game saves.
[open-adventure.git] / misc.c
diff --git a/misc.c b/misc.c
index c47ce1d8ed4007cf8dc8e14b6c446a36e85794a8..6ca1f876ac21a2b9e2acfaecbc09c8222acf6117 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -367,7 +367,7 @@ void MOVE(long object, long where)
        from=game.fixed[object-NOBJECTS];
     else
        from=game.place[object];
-    if (from > 0 && from <= 300)
+    if (from > 0 && !SPECIAL(from))
        CARRY(object,from);
     DROP(object,where);
 }
@@ -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)