diff options
author | ache <ache@FreeBSD.org> | 1997-09-24 06:11:10 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-09-24 06:11:10 +0000 |
commit | 6dda81e2d74e6e691091e4a859b2462a7388a8b3 (patch) | |
tree | 5443cc39209eab6feab25a4d9292376de1c6ccf6 /games | |
parent | f3087f06ac098064514c3cc4e896d0d63c7697d4 (diff) | |
download | FreeBSD-src-6dda81e2d74e6e691091e4a859b2462a7388a8b3.zip FreeBSD-src-6dda81e2d74e6e691091e4a859b2462a7388a8b3.tar.gz |
Use srandomdev
Cleanup
Diffstat (limited to 'games')
-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 8236c52..249405e 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 9f10df8..9e7f977 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 0a18e26..a4d40e0 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); } |