define Rand() in isaac4 config
Rand() was typically defined to random() or to rand(). gcc seems to provide a random() to link to on linux when sys/share/random.c is linked in, but other platforms such as Windows got an undefined refence to random() when RANDOM wasn't defined. The only direct use seems to be in get_rnd_txt() these days, in rumors.c Under the USE_ISAAC64 config, neither srandom() nor srand() are being invoked to seed those routines, and it really should be using isaac64 when USE_ISAAC64 is defined anyway.
This commit is contained in:
+9
-5
@@ -7,9 +7,6 @@
|
|||||||
|
|
||||||
/* #define SHELL */ /* nt use of pcsys routines caused a hang */
|
/* #define SHELL */ /* nt use of pcsys routines caused a hang */
|
||||||
|
|
||||||
/* #define RANDOM */ /* have Berkeley random(3) */
|
|
||||||
#define USE_ISAAC64
|
|
||||||
|
|
||||||
#define TEXTCOLOR /* Color text */
|
#define TEXTCOLOR /* Color text */
|
||||||
|
|
||||||
#define EXEPATH /* Allow .exe location to be used as HACKDIR */
|
#define EXEPATH /* Allow .exe location to be used as HACKDIR */
|
||||||
@@ -37,8 +34,9 @@
|
|||||||
|
|
||||||
/*#define CHANGE_COLOR*/ /* allow palette changes */
|
/*#define CHANGE_COLOR*/ /* allow palette changes */
|
||||||
#define SELECTSAVED /* Provide menu of saved games to choose from at start */
|
#define SELECTSAVED /* Provide menu of saved games to choose from at start */
|
||||||
|
|
||||||
#define SYS_RANDOM_SEED /* Use random seed derived from CNG */
|
#define SYS_RANDOM_SEED /* Use random seed derived from CNG */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -----------------------------------------------------------------
|
* -----------------------------------------------------------------
|
||||||
* The remaining code shouldn't need modification.
|
* The remaining code shouldn't need modification.
|
||||||
@@ -182,12 +180,18 @@ extern void FDECL(interject, (int));
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define USE_STDARG
|
#define USE_STDARG
|
||||||
#ifdef RANDOM
|
|
||||||
/* Use the high quality random number routines. */
|
/* Use the high quality random number routines. */
|
||||||
|
#ifdef USE_ISAAC64
|
||||||
|
#define Rand() rn2(RAND_MAX)
|
||||||
|
#else
|
||||||
|
#define RANDOM
|
||||||
|
#ifdef RANDOM
|
||||||
#define Rand() random()
|
#define Rand() random()
|
||||||
#else
|
#else
|
||||||
#define Rand() rand()
|
#define Rand() rand()
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#define FCMASK (_S_IREAD | _S_IWRITE) /* file creation mask */
|
#define FCMASK (_S_IREAD | _S_IWRITE) /* file creation mask */
|
||||||
|
|||||||
+4
-1
@@ -78,12 +78,15 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
/* the high quality random number routines */
|
/* the high quality random number routines */
|
||||||
|
#ifdef USE_ISAAC64
|
||||||
|
#define Rand() rn2(RAND_MAX)
|
||||||
|
#else
|
||||||
#ifdef RANDOM
|
#ifdef RANDOM
|
||||||
#define Rand() random()
|
#define Rand() random()
|
||||||
#else
|
#else
|
||||||
#define Rand() rand()
|
#define Rand() rand()
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* file creation mask */
|
/* file creation mask */
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -236,12 +236,16 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* the high quality random number routines */
|
||||||
|
#ifdef USE_ISAAC64
|
||||||
|
#define Rand() rn2(RAND_MAX)
|
||||||
|
#else
|
||||||
#ifdef RANDOM
|
#ifdef RANDOM
|
||||||
/* Use the high quality random number routines. */
|
|
||||||
#define Rand() random()
|
#define Rand() random()
|
||||||
#else
|
#else
|
||||||
#define Rand() rand()
|
#define Rand() rand()
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef TOS
|
#ifndef TOS
|
||||||
#define FCMASK 0660 /* file creation mask */
|
#define FCMASK 0660 /* file creation mask */
|
||||||
|
|||||||
@@ -347,12 +347,17 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Use the high quality random number routines. */
|
/* Use the high quality random number routines. */
|
||||||
|
/* the high quality random number routines */
|
||||||
|
#ifdef USE_ISAAC64
|
||||||
|
#define Rand() rn2(RAND_MAX)
|
||||||
|
#else
|
||||||
#if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \
|
#if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \
|
||||||
|| defined(RANDOM) || defined(__APPLE__)
|
|| defined(RANDOM) || defined(__APPLE__)
|
||||||
#define Rand() random()
|
#define Rand() random()
|
||||||
#else
|
#else
|
||||||
#define Rand() lrand48()
|
#define Rand() lrand48()
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TIMED_DELAY
|
#ifdef TIMED_DELAY
|
||||||
#if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX))
|
#if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX))
|
||||||
|
|||||||
@@ -243,6 +243,9 @@ typedef __mode_t mode_t;
|
|||||||
#define rindex strrchr
|
#define rindex strrchr
|
||||||
|
|
||||||
/* Use the high quality random number routines. */
|
/* Use the high quality random number routines. */
|
||||||
|
#ifdef USE_ISAAC64
|
||||||
|
#define Rand() rn2(RAND_MAX)
|
||||||
|
#else
|
||||||
#if defined(RANDOM)
|
#if defined(RANDOM)
|
||||||
#define Rand() random()
|
#define Rand() random()
|
||||||
/* VMS V7 adds these entry points to DECC$SHR; stick with the nethack-supplied
|
/* VMS V7 adds these entry points to DECC$SHR; stick with the nethack-supplied
|
||||||
@@ -255,6 +258,7 @@ typedef __mode_t mode_t;
|
|||||||
#else
|
#else
|
||||||
#define Rand() rand()
|
#define Rand() rand()
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#define SYS_RANDOM_SEED
|
#define SYS_RANDOM_SEED
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
|
|||||||
+6
-1
@@ -141,12 +141,17 @@
|
|||||||
#define index strchr
|
#define index strchr
|
||||||
#define rindex strrchr
|
#define rindex strrchr
|
||||||
#define USE_STDARG
|
#define USE_STDARG
|
||||||
#ifdef RANDOM
|
|
||||||
/* Use the high quality random number routines. */
|
/* Use the high quality random number routines. */
|
||||||
|
#ifdef USE_ISAAC64
|
||||||
|
#define Rand() rn2(RAND_MAX)
|
||||||
|
#else
|
||||||
|
#ifdef RANDOM
|
||||||
#define Rand() random()
|
#define Rand() random()
|
||||||
#else
|
#else
|
||||||
#define Rand() rand()
|
#define Rand() rand()
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FCMASK 0660 /* file creation mask */
|
#define FCMASK 0660 /* file creation mask */
|
||||||
#define regularize nt_regularize
|
#define regularize nt_regularize
|
||||||
|
|||||||
Reference in New Issue
Block a user