From f4d68590c24c93f53458cea581b3504970d0bcf2 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sat, 2 Sep 2017 17:31:01 -0500 Subject: [PATCH] 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. --- code/q3_ui/ui_servers2.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code/q3_ui/ui_servers2.c b/code/q3_ui/ui_servers2.c index 93e4697b..e709925e 100644 --- a/code/q3_ui/ui_servers2.c +++ b/code/q3_ui/ui_servers2.c @@ -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; } }