Fix loading favorites as initial source in server browser

When I added UIAS_GLOBAL0 in 2017 I missed changing ui_browserMaster
range clamp from 6 to 7.

Reported by cdev-tux.
This commit is contained in:
Zack Middleton 2018-08-28 21:33:51 -05:00
parent c7ebe82131
commit 29db64070a

View file

@ -88,6 +88,7 @@ MULTIPLAYER MENU (SERVER BROWSER)
#define UIAS_GLOBAL4 5
#define UIAS_GLOBAL5 6
#define UIAS_FAVORITES 7
#define UIAS_NUM_SOURCES 8
#define UI_MAX_MASTER_SERVERS 6
@ -96,12 +97,14 @@ MULTIPLAYER MENU (SERVER BROWSER)
#define SORT_CLIENTS 2
#define SORT_GAME 3
#define SORT_PING 4
#define SORT_NUM_SORTS 5
#define GAMES_ALL 0
#define GAMES_FFA 1
#define GAMES_TEAMPLAY 2
#define GAMES_TOURNEY 3
#define GAMES_CTF 4
#define GAMES_NUM_GAMES 5
static const char *master_items[] = {
"Local",
@ -1104,7 +1107,7 @@ int ArenaServers_SetType( int type )
char masterstr[2], cvarname[sizeof("sv_master1")];
int direction;
if (type == g_servertype || type == ((g_servertype+1) % (ARRAY_LEN(master_items)-1))) {
if (type == g_servertype || type == ((g_servertype+1) % UIAS_NUM_SOURCES)) {
direction = 1;
} else {
direction = -1;
@ -1585,12 +1588,12 @@ static void ArenaServers_MenuInit( void ) {
ArenaServers_LoadFavorites();
g_arenaservers.master.curvalue = g_servertype = Com_Clamp( 0, 6, ui_browserMaster.integer );
g_arenaservers.master.curvalue = g_servertype = Com_Clamp( 0, UIAS_NUM_SOURCES-1, ui_browserMaster.integer );
g_gametype = Com_Clamp( 0, 4, ui_browserGameType.integer );
g_gametype = Com_Clamp( 0, GAMES_NUM_GAMES-1, ui_browserGameType.integer );
g_arenaservers.gametype.curvalue = g_gametype;
g_sortkey = Com_Clamp( 0, 4, ui_browserSortKey.integer );
g_sortkey = Com_Clamp( 0, SORT_NUM_SORTS-1, ui_browserSortKey.integer );
g_arenaservers.sortkey.curvalue = g_sortkey;
g_fullservers = Com_Clamp( 0, 1, ui_browserShowFull.integer );