Accessing server cvars in bg_*

Locked
jkoder
Posts: 59
Joined: Tue Jun 17, 2008 9:10 pm

Accessing server cvars in bg_*

Post 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
TTK-Bandit
Posts: 190
Joined: Sat Sep 07, 2002 7:00 am

Re: Accessing server cvars in bg_*

Post 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.
jkoder
Posts: 59
Joined: Tue Jun 17, 2008 9:10 pm

Re: Accessing server cvars in bg_*

Post by jkoder »

Thanks a lot for your reply Bandit.
Locked