diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 1997-09-24 06:11:10 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 1997-09-24 06:11:10 +0000 |
commit | 60f6447b3d63fbcdfae42ba5ea305b99445049ee (patch) | |
tree | 1d646c86c996567c5f9be98d8b368e484a04de9e /games/adventure | |
parent | 0ba4030b3d0aa501dff418626c41af7b16afcfcf (diff) | |
download | src-60f6447b3d63fbcdfae42ba5ea305b99445049ee.tar.gz src-60f6447b3d63fbcdfae42ba5ea305b99445049ee.zip |
Use srandomdev
Cleanup
Notes
Notes:
svn path=/head/; revision=29773
Diffstat (limited to 'games/adventure')
-rw-r--r-- | games/adventure/init.c | 8 | ||||
-rw-r--r-- | games/adventure/setup.c | 1 | ||||
-rw-r--r-- | games/adventure/wizard.c | 20 |
3 files changed, 14 insertions, 15 deletions
diff --git a/games/adventure/init.c b/games/adventure/init.c index 8236c52e04b3..249405ec2069 100644 --- a/games/adventure/init.c +++ b/games/adventure/init.c @@ -54,8 +54,7 @@ int setbit[16] = {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000, 010000,020000,040000,0100000}; -init(command) /* everything for 1st time run */ -char *command; /* command we were called with */ +init() /* everything for 1st time run */ { rdata(); /* read data from orig. file */ linkdata(); @@ -205,11 +204,8 @@ trapdel() /* come here if he hits a del */ startup() { - time_t time(); - demo=Start(0); - srand((int)(time((time_t *)NULL))); /* random seed */ - /* srand(371); */ /* non-random seed */ + srandomdev(); hinted[3]=yes(65,1,0); newloc=1; delhit = 0; diff --git a/games/adventure/setup.c b/games/adventure/setup.c index 9f10df87f253..9e7f9772e578 100644 --- a/games/adventure/setup.c +++ b/games/adventure/setup.c @@ -58,6 +58,7 @@ static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93"; #define SIG2 " * Sterday, 6 Thrimidge S.R. 1993, 15:24" #include <stdio.h> +#include <stdlib.h> #include "hdr.h" /* SEED lives in there; keep them coordinated. */ #define USAGE "Usage: setup file > data.c (file is typically glorkz)\n" diff --git a/games/adventure/wizard.c b/games/adventure/wizard.c index 0a18e265e494..a4d40e07659a 100644 --- a/games/adventure/wizard.c +++ b/games/adventure/wizard.c @@ -44,20 +44,22 @@ static char sccsid[] = "@(#)wizard.c 8.1 (Berkeley) 6/2/93"; #include <sys/types.h> #include <stdio.h> +#include <stdlib.h> +#include <time.h> # include "hdr.h" datime(d,t) int *d,*t; -{ int tvec[2],*tptr; - int *localtime(); +{ struct tm *tptr; + time_t tvec; - time(tvec); - tptr=localtime(tvec); - *d=tptr[7]+365*(tptr[5]-77); /* day since 1977 (mod leap) */ + time(&tvec); + tptr=localtime(&tvec); + *d=tptr->tm_yday+365*(tptr->tm_year-77); /* day since 1977 (mod leap) */ /* bug: this will overflow in the year 2066 AD */ /* it will be attributed to Wm the C's millenial celebration */ - *t=tptr[2]*60+tptr[1]; /* and minutes since midnite */ -} /* pretty painless */ + *t=tptr->tm_hour*60+tptr->tm_min; /* and minutes since midnite */ +} /* pretty painless */ char magic[6]; @@ -128,8 +130,8 @@ char *cmdfile; ran(range) int range; { - long rand(), i; + int i; - i = rand() % range; + i = random() % range; return(i); } |