Make sure Q2 doesn't "forget" contents of server "address book"

The problem was that the cvars were only initialized (with CVar_Get())
if you opened the address book menu.
So if you start (and possibly run) and quit the game /without/ opening
that menu (or at least the "join network server" menu), the game will
not save those cvars to the config when it next writes it.

To prevent this, *always* initialize the cvars in M_Init().
This commit is contained in:
Daniel Gibson 2018-02-12 01:03:06 +01:00
parent 3634ed7013
commit 1c7b02cc85

View file

@ -4380,6 +4380,15 @@ M_Init(void)
Cmd_AddCommand("menu_options", M_Menu_Options_f);
Cmd_AddCommand("menu_keys", M_Menu_Keys_f);
Cmd_AddCommand("menu_quit", M_Menu_Quit_f);
/* initialize the server address book cvars (adr0, adr1, ...)
* so the entries are not lost if you don't open the address book */
for (int index = 0; index < NUM_ADDRESSBOOK_ENTRIES; index++)
{
char buffer[20];
Com_sprintf(buffer, sizeof(buffer), "adr%d", index);
Cvar_Get(buffer, "", CVAR_ARCHIVE);
}
}
void