Use more portable random seed generation.
The new function md_random_seed() has replaced time() + getpid() and similar methods. Putting everything in mdport.c slightly reduces the warnings and workarounds.
This commit is contained in:
parent
c194ec3dc9
commit
62047972cc
29 changed files with 123 additions and 81 deletions
|
|
@ -48,8 +48,6 @@ main(int argc, char *argv[], char *envp[])
|
|||
register struct object *obj;
|
||||
char alldone, wpt;
|
||||
char *getpass(), *xcrypt(), *strrchr();
|
||||
int lowtime;
|
||||
time_t now;
|
||||
char *homedir = roguehome();
|
||||
|
||||
md_init();
|
||||
|
|
@ -102,8 +100,6 @@ main(int argc, char *argv[], char *envp[])
|
|||
}
|
||||
}
|
||||
#endif
|
||||
time(&now);
|
||||
lowtime = (int) now;
|
||||
|
||||
#ifdef SAVEDIR
|
||||
if (argc >= 3 && !strcmp(argv[1], "-n")) {
|
||||
|
|
@ -169,7 +165,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
/* START NEW GAME */
|
||||
|
||||
dnum = (wizard && getenv("SEED") != NULL ?
|
||||
atoi(getenv("SEED")) : lowtime + md_getpid());
|
||||
atoi(getenv("SEED")) : md_random_seed());
|
||||
|
||||
if(wizard)
|
||||
printf("Hello %s, welcome to dungeon #%d\n", whoami, dnum);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue