From b290a6cace16fb813438af50629fb7876862294e Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 30 Mar 2007 08:48:11 +0000 Subject: [PATCH] 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 --- cl_demo.c | 2 ++ host.c | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) 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) -- 2.39.2