Page 1 of 1

Accessing server cvars in bg_*

Posted: Sat Jul 05, 2008 3:50 pm
by jkoder
Hello again,

Can anyone tell me how to access cvars which I declared in g_local.h and g_main.c in the
the files starting with bg_*. I want to check a cvar in bg_misc.c which I declared g_local.h in but it's not available/visible.

This is probably not a Quake question but more basic C stuff and it really underlines my lack of skills in C. :(

Can anyone throw me a bone on this?

Cheers

Re: Accessing server cvars in bg_*

Posted: Sun Jul 06, 2008 2:08 am
by TTK-Bandit
since bg_* files are used by both game and cgame, you cant access the cvars directly.
you need to work with the CVAR_SERVERINFO flag and access them via trap_GetServerinfo & Info_ValueForKey
depending on how often you need them, you might wanna save them temporarily in a variable instead of parsing the serverinfo each frame.

Re: Accessing server cvars in bg_*

Posted: Sun Jul 06, 2008 11:49 am
by jkoder
Thanks a lot for your reply Bandit.