mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed reverse sorting
This commit is contained in:
parent
fc554e113b
commit
c3320e9d07
|
@ -158,6 +158,7 @@ static int client_serverbrowse_sorthash()
|
|||
i |= config.b_filter_empty<<4;
|
||||
i |= config.b_filter_full<<5;
|
||||
i |= config.b_filter_pw<<6;
|
||||
i |= config.b_sort_order<<7;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -182,6 +183,17 @@ static void client_serverbrowse_sort()
|
|||
else if(config.b_sort == BROWSESORT_PROGRESSION)
|
||||
qsort(sorted_serverlist, num_sorted_servers, sizeof(int), client_serverbrowse_sort_compare_progression);
|
||||
|
||||
/* invert the list if requested */
|
||||
if(config.b_sort_order)
|
||||
{
|
||||
for(i = 0; i < num_sorted_servers/2; i++)
|
||||
{
|
||||
int temp = sorted_serverlist[i];
|
||||
sorted_serverlist[i] = sorted_serverlist[num_sorted_servers-i-1];
|
||||
sorted_serverlist[num_sorted_servers-i-1] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
/* set indexes */
|
||||
for(i = 0; i < num_sorted_servers; i++)
|
||||
serverlist[sorted_serverlist[i]]->info.sorted_index = i;
|
||||
|
|
|
@ -17,6 +17,7 @@ MACRO_CONFIG_INT(b_filter_full, 0, 0, 1)
|
|||
MACRO_CONFIG_INT(b_filter_empty, 0, 0, 1)
|
||||
MACRO_CONFIG_INT(b_filter_pw, 0, 0, 1)
|
||||
MACRO_CONFIG_INT(b_sort, 0, 0, 256)
|
||||
MACRO_CONFIG_INT(b_sort_order, 0, 0, 1)
|
||||
MACRO_CONFIG_INT(b_max_requests, 10, 0, 1000)
|
||||
|
||||
MACRO_CONFIG_INT(snd_rate, 48000, 0, 0)
|
||||
|
|
|
@ -947,7 +947,13 @@ static void menu2_render_serverbrowser(RECT main_view)
|
|||
if(ui2_do_button(cols[i].caption, cols[i].caption, config.b_sort == cols[i].sort, &cols[i].rect, ui2_draw_grid_header, 0))
|
||||
{
|
||||
if(cols[i].sort != -1)
|
||||
{
|
||||
if(config.b_sort == cols[i].sort)
|
||||
config.b_sort_order ^= 1;
|
||||
else
|
||||
config.b_sort_order = 0;
|
||||
config.b_sort = cols[i].sort;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue