diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-10-21 18:50:23 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-10-21 18:50:23 +0000 |
| commit | 66579c87a21de9d155f6643ad35d3af2ffd2edcb (patch) | |
| tree | 452dd918c20f37a2ae21ab7c14bb7e407bc8b433 | |
| parent | d15f0cfcf24c260f66345157bc465619247bf0cb (diff) | |
| download | zcatch-66579c87a21de9d155f6643ad35d3af2ffd2edcb.tar.gz zcatch-66579c87a21de9d155f6643ad35d3af2ffd2edcb.zip | |
fixed gametype filtering
| -rw-r--r-- | src/engine/client/ec_srvbrowse.c | 70 | ||||
| -rw-r--r-- | src/game/client/components/menus_browser.cpp | 11 |
2 files changed, 43 insertions, 38 deletions
diff --git a/src/engine/client/ec_srvbrowse.c b/src/engine/client/ec_srvbrowse.c index f1dc9701..46d6a5f4 100644 --- a/src/engine/client/ec_srvbrowse.c +++ b/src/engine/client/ec_srvbrowse.c @@ -170,45 +170,49 @@ static void client_serverbrowse_filter() filtered = 1; else if(config.b_filter_compatversion && strncmp(serverlist[i]->info.version, modc_net_version(), 3) != 0) filtered = 1; - else if(config.b_filter_string[0] != 0) + else { - int matchfound = 0; - - serverlist[i]->info.quicksearch_hit = 0; - - /* match against server name */ - if(str_find_nocase(serverlist[i]->info.name, config.b_filter_string)) + if(config.b_filter_string[0] != 0) { - matchfound = 1; - serverlist[i]->info.quicksearch_hit |= BROWSEQUICK_SERVERNAME; - } + int matchfound = 0; + + serverlist[i]->info.quicksearch_hit = 0; - /* match against players */ - for(p = 0; p < serverlist[i]->info.num_players; p++) - { - if(str_find_nocase(serverlist[i]->info.players[p].name, config.b_filter_string)) + /* match against server name */ + if(str_find_nocase(serverlist[i]->info.name, config.b_filter_string)) + { + matchfound = 1; + serverlist[i]->info.quicksearch_hit |= BROWSEQUICK_SERVERNAME; + } + + /* match against players */ + for(p = 0; p < serverlist[i]->info.num_players; p++) + { + if(str_find_nocase(serverlist[i]->info.players[p].name, config.b_filter_string)) + { + matchfound = 1; + serverlist[i]->info.quicksearch_hit |= BROWSEQUICK_PLAYERNAME; + break; + } + } + + /* match against map */ + if(str_find_nocase(serverlist[i]->info.map, config.b_filter_string)) { matchfound = 1; - serverlist[i]->info.quicksearch_hit |= BROWSEQUICK_PLAYERNAME; - break; + serverlist[i]->info.quicksearch_hit |= BROWSEQUICK_MAPNAME; } + + if(!matchfound) + filtered = 1; } - /* match against map */ - if(str_find_nocase(serverlist[i]->info.map, config.b_filter_string)) + if(!filtered && config.b_filter_gametype[0] != 0) { - matchfound = 1; - serverlist[i]->info.quicksearch_hit |= BROWSEQUICK_MAPNAME; + /* match against game type */ + if(!str_find_nocase(serverlist[i]->info.gametype, config.b_filter_gametype)) + filtered = 1; } - - if(!matchfound) - filtered = 1; - } - else if(config.b_filter_gametype[0] != 0) - { - /* match against game type */ - if(!str_find_nocase(serverlist[i]->info.gametype, config.b_filter_gametype)) - filtered = 1; } if(filtered == 0) @@ -321,6 +325,14 @@ void client_serverbrowse_setinfo(SERVERENTRY *entry, SERVER_INFO *info) entry->info = *info; entry->info.favorite = fav; entry->info.netaddr = entry->addr; + + // all these are just for nice compability + if(entry->info.gametype[0] == '0' && entry->info.gametype[1] == 0) + str_copy(entry->info.gametype, "DM", sizeof(entry->info.gametype)); + else if(entry->info.gametype[0] == '1' && entry->info.gametype[1] == 0) + str_copy(entry->info.gametype, "TDM", sizeof(entry->info.gametype)); + else if(entry->info.gametype[0] == '2' && entry->info.gametype[1] == 0) + str_copy(entry->info.gametype, "CTF", sizeof(entry->info.gametype)); /*if(!request) { diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index bd614999..5f328e58 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -290,16 +290,9 @@ void MENUS::render_serverbrowser_serverlist(RECT view) } else if(id == COL_GAMETYPE) { - // all these are just for nice compability - if(item->gametype[0] == '0' && item->gametype[1] == 0) - ui_do_label(&button, "DM", 12.0f, 0); - else if(item->gametype[0] == '1' && item->gametype[1] == 0) - ui_do_label(&button, "TDM", 12.0f, 0); - else if(item->gametype[0] == '2' && item->gametype[1] == 0) - ui_do_label(&button, "CTF", 12.0f, 0); - else - ui_do_label(&button, item->gametype, 12.0f, 0); + ui_do_label(&button, item->gametype, 12.0f, 0); } + } } |