From e1334495e1a5746efd62717988f9e6aa7cedb423 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Mon, 13 Oct 2008 06:30:18 +0000 Subject: [PATCH] properly seed the pseudo-random number generator git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2994 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/server.cpp | 2 ++ source/src/tools.h | 2 -- source/src/worldlight.cpp | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/source/src/server.cpp b/source/src/server.cpp index cda3bcbe..6d90dd11 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -3288,6 +3288,8 @@ void localconnect() void initserver(bool dedicated, int uprate, const char *sdesc, const char *sdesc_pre, const char *sdesc_suf, const char *ip, int serverport, const char *master, const char *passwd, int maxcl, const char *maprot, const char *adminpwd, const char *pwdfile, const char *blfile, const char *srvmsg, int scthreshold) { + srand(time(NULL)); + if(serverport<=0) serverport = CUBE_DEFAULT_SERVER_PORT; if(passwd) s_strcpy(serverpassword, passwd); maxclients = maxcl > 0 ? min(maxcl, MAXCLIENTS) : DEFAULTCLIENTS; diff --git a/source/src/tools.h b/source/src/tools.h index 364c13ee..c6d26a4c 100644 --- a/source/src/tools.h +++ b/source/src/tools.h @@ -59,8 +59,6 @@ static inline float round(float x) { return floor(x + 0.5f); } #define clamp(a,b,c) (max(b, min(a, c))) #define rnd(max) (rand()%(max)) -#define rndreset() (srand(1)) -#define rndtime() { loopi(lastmillis&0xF) rnd(i+1); } #define detrnd(s, x) ((int)(((((uint)(s))*1103515245+12345)>>16)%(x))) #define loop(v,m) for(int v = 0; v