From: havoc Date: Fri, 30 Mar 2007 08:48:11 +0000 (+0000) Subject: make timedemo and -benchmark use srand(0) to get more predictable results X-Git-Tag: xonotic-v0.1.0preview~3388 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b290a6cace16fb813438af50629fb7876862294e;p=xonotic%2Fdarkplaces.git make timedemo and -benchmark use srand(0) to get more predictable results git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7030 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_demo.c b/cl_demo.c index 5539c70c..ce5f95d7 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -421,6 +421,8 @@ void CL_TimeDemo_f (void) return; } + srand(0); // predictable random sequence for benchmarking + CL_PlayDemo_f (); // cls.td_starttime will be grabbed at the second frame of the demo, so diff --git a/host.c b/host.c index aea36ef3..13cd0591 100644 --- a/host.c +++ b/host.c @@ -613,8 +613,8 @@ void Host_Main(void) if (cl_maxfps.value < 1) Cvar_SetValue("cl_maxfps", 1); - // keep the random time dependent - if(!*sv_random_seed.string) + // keep the random time dependent, but not when playing demos/benchmarking + if(!*sv_random_seed.string && !cls.demoplayback) rand(); cl.islocalgame = NetConn_IsLocalGame(); @@ -888,7 +888,10 @@ static void Host_Init (void) const char* os; // LordHavoc: quake never seeded the random number generator before... heh - srand(time(NULL)); + if (COM_CheckParm("-benchmark")) + srand(0); // predictable random sequence for -benchmark + else + srand(time(NULL)); // FIXME: this is evil, but possibly temporary // COMMANDLINEOPTION: Console: -developer enables warnings and other notices (RECOMMENDED for mod developers)