Fix going to previous browser source in q3_ui

It wasn't possible to go to previous source from favorites if
sv_master5 cvar wasn't set.
This commit is contained in:
Zack Middleton 2017-09-02 17:31:01 -05:00
parent c3e64d3806
commit f4d68590c2

View file

@ -1102,15 +1102,22 @@ int ArenaServers_SetType( int type )
if(type >= UIAS_GLOBAL1 && type <= UIAS_GLOBAL5)
{
char masterstr[2], cvarname[sizeof("sv_master1")];
int direction;
while(type <= UIAS_GLOBAL5)
if (type == g_servertype || type == ((g_servertype+1) % (ARRAY_LEN(master_items)-1))) {
direction = 1;
} else {
direction = -1;
}
while(type >= UIAS_GLOBAL1 && type <= UIAS_GLOBAL5)
{
Com_sprintf(cvarname, sizeof(cvarname), "sv_master%d", type - UIAS_GLOBAL0);
trap_Cvar_VariableStringBuffer(cvarname, masterstr, sizeof(masterstr));
if(*masterstr)
break;
type++;
type += direction;
}
}