X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=main.c;h=57197e9c45c7f4ccb92b60b09f5c1a2e060f9916;hb=77d2a1e5dd5d5ff3353a54ad0741427f7f2b8c28;hp=e2c24e59847abc01b035fecc4432fd93da044e3e;hpb=d6b59a1c12ad8829de004dc3b478fde2a7ff197d;p=open-adventure.git diff --git a/main.c b/main.c index e2c24e5..57197e9 100644 --- a/main.c +++ b/main.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "main.h" #include "database.h" #include "misc.h" @@ -29,7 +30,7 @@ long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS, I, INVENT, IGO, IWEST, J, JADE, K, K2, KEYS, KK, KNFLOC, KNIFE, KQ, L, LAMP, LIMIT, LL, LMWARN, LOC, LOCK, LOOK, - MAGZIN, MAXDIE, MAXTRS, MESH = 123456789, + MAGZIN, MAXDIE, MAXTRS, MESSAG, MIRROR, MXSCOR, NEWLOC, NOVICE, NUGGET, NUL, NUMDIE, OBJ, ODLOC[7], OGRE, OIL, OLDLC2, OLDLOC, OLDOBJ, OYSTER, @@ -109,7 +110,8 @@ int main(int argc, char *argv[]) { lcgstate.a = 1093; lcgstate.c = 221587; lcgstate.m = 1048576; - long seedval = (long)time(NULL); + srand(time(NULL)); + long seedval = (long)rand(); set_seed(seedval); /* Read the database if we have not yet done so */ @@ -130,7 +132,7 @@ int main(int argc, char *argv[]) { L1: SETUP= -1; I=0; - ZZWORD=RNDVOC(3,0)+MESH*2; + ZZWORD=RNDVOC(3,0); NOVICE=YES(stdin, 65,1,0); NEWLOC=1; LOC=1; @@ -154,8 +156,10 @@ static bool fallback_handler(signed char *buf) if (sscanf(buf, "seed %ld", &sv) == 1) { set_seed(sv); printf("Seed set to %ld\n", sv); + // autogenerated, so don't charge user time for it. + --TURNS; // here we reconfigure any global game state that uses random numbers - ZZWORD=RNDVOC(3,0)+MESH*2; + ZZWORD=RNDVOC(3,0); return true; } return false; @@ -399,8 +403,7 @@ L2600: if(COND[LOC] < CONDS) goto L2603; L2602: /*etc*/ ; } /* end loop */ -/* Kick the random number generator just to add variety to the chase. Also, - * if closing time, check for any objects being toted with PROP < 0 and set +/* If closing time, check for any objects being toted with PROP < 0 and set * the prop to -1-PROP. This way objects won't be described until they've * been picked up and put down separate from their respective piles. Don't * tick CLOCK1 unless well into cave (and not at Y2). */ @@ -920,4 +923,5 @@ L12400: LIMIT= -1; L18999: RSPEAK(SPK); L19000: RSPEAK(136); score(0); + return true; }