From 569edcb04e5c961c292a083db8b9cb3291feef78 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 14 Sep 2009 19:28:59 +0000 Subject: [PATCH] Minor reworking to check command line cvars before Com_InitZoneMemory(). This lets you set com_zoneMegs from the command line (although still not from a config file, but oh well). Fixes Bugzilla #2571. --- code/qcommon/common.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/code/qcommon/common.c b/code/qcommon/common.c index 75e5f80b..f0a341bf 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -1397,9 +1397,11 @@ void Com_InitSmallZoneMemory( void ) { void Com_InitZoneMemory( void ) { cvar_t *cv; - //FIXME: 05/01/06 com_zoneMegs is useless right now as neither q3config.cfg nor - // Com_StartupVariable have been executed by this point. The net result is that - // s_zoneTotal will always be set to the default value. + // Please note: com_zoneMegs can only be set on the command line, and + // not in q3config.cfg or Com_StartupVariable, as they haven't been + // executed by this point. It's a chicken and egg problem. We need the + // memory manager configured to handle those places where you would + // configure the memory manager. // allocate the random block zone cv = Cvar_Get( "com_zoneMegs", DEF_COMZONEMEGS_S, CVAR_LATCH | CVAR_ARCHIVE ); @@ -2550,12 +2552,12 @@ void Com_Init( char *commandLine ) { // Swap_Init (); Cbuf_Init (); - Com_InitZoneMemory(); - Cmd_Init (); - // override anything from the config files with command line args Com_StartupVariable( NULL ); + Com_InitZoneMemory(); + Cmd_Init (); + // get the developer cvar set as early as possible Com_StartupVariable( "developer" );