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; } }