Fix creating favorite when not on view favorite servers

This commit is contained in:
Zack Middleton 2013-02-07 21:03:33 -06:00
parent fe47952bf5
commit 7ccdff6e12

View file

@ -3481,28 +3481,26 @@ static void UI_RunMenuScript(char **args) {
} }
} }
} else if (Q_stricmp(name, "createFavorite") == 0) { } else if (Q_stricmp(name, "createFavorite") == 0) {
if (ui_netSource.integer == UIAS_FAVORITES) { char name[MAX_NAME_LENGTH];
char name[MAX_NAME_LENGTH]; char addr[MAX_ADDRESSLENGTH];
char addr[MAX_ADDRESSLENGTH]; int res;
int res;
name[0] = addr[0] = '\0'; name[0] = addr[0] = '\0';
Q_strncpyz(name, UI_Cvar_VariableString("ui_favoriteName"), sizeof ( name ) ); Q_strncpyz(name, UI_Cvar_VariableString("ui_favoriteName"), sizeof ( name ) );
Q_strncpyz(addr, UI_Cvar_VariableString("ui_favoriteAddress"), sizeof ( addr ) ); Q_strncpyz(addr, UI_Cvar_VariableString("ui_favoriteAddress"), sizeof ( addr ) );
if (strlen(name) > 0 && strlen(addr) > 0) { if (strlen(name) > 0 && strlen(addr) > 0) {
res = trap_LAN_AddServer(AS_FAVORITES, name, addr); res = trap_LAN_AddServer(AS_FAVORITES, name, addr);
if (res == 0) { if (res == 0) {
// server already in the list // server already in the list
Com_Printf("Favorite already in list\n"); Com_Printf("Favorite already in list\n");
} }
else if (res == -1) { else if (res == -1) {
// list full // list full
Com_Printf("Favorite list full\n"); Com_Printf("Favorite list full\n");
} }
else { else {
// successfully added // successfully added
Com_Printf("Added favorite server %s\n", addr); Com_Printf("Added favorite server %s\n", addr);
}
} }
} }
} else if (Q_stricmp(name, "orders") == 0) { } else if (Q_stricmp(name, "orders") == 0) {