mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-18 14:31:52 +00:00
sb2 bugfixes/tweeks/improvements.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2110 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
7f44a306f4
commit
28bff4208d
3 changed files with 84 additions and 11 deletions
|
@ -42,6 +42,8 @@ typedef enum{
|
|||
|
||||
SLKEY_FREEPLAYERS,
|
||||
SLKEY_BASEGAME,
|
||||
SLKEY_TIMELIMIT,
|
||||
SLKEY_FRAGLIMIT,
|
||||
|
||||
SLKEY_TOOMANY,
|
||||
SLKEY_CUSTOM
|
||||
|
|
|
@ -901,15 +901,21 @@ typedef struct {
|
|||
|
||||
void SL_TitlesDraw (int x, int y, menucustom_t *ths, menu_t *menu)
|
||||
{
|
||||
char *smark;
|
||||
int sf = Master_GetSortField();
|
||||
if (Master_GetSortDescending())
|
||||
smark = "^6%s";
|
||||
else
|
||||
smark = "^5%s";
|
||||
x = ths->common.width/8;
|
||||
if (sb_showtimelimit.value) {x-=4; Draw_FunStringLen(x+8, y, "tl", 3); }
|
||||
if (sb_showfraglimit.value) {x-=4; Draw_FunStringLen(x+8, y, "fl", 3); }
|
||||
if (sb_showplayers.value) {Draw_FunStringLen((x-5)*8, y, "plyrs", 5); x-=6;}
|
||||
if (sb_showmap.value) {Draw_FunStringLen((x-8)*8, y, "map", 8); x-=9;}
|
||||
if (sb_showgamedir.value) {Draw_FunStringLen((x-8)*8, y, "gamedir", 8); x-=9;}
|
||||
if (sb_showping.value) {Draw_FunStringLen((x-3)*8, y, "png", 3); x-=4;}
|
||||
if (sb_showaddress.value) {Draw_FunStringLen((x-21)*8, y, "address", 21); x-=22;}
|
||||
Draw_FunStringLen(0, y, "name", x);
|
||||
if (sb_showtimelimit.value) {Draw_FunStringLen((x-3)*8, y, va((sf==SLKEY_TIMELIMIT)?smark:"%s", "tl"), 3); x-=4;}
|
||||
if (sb_showfraglimit.value) {Draw_FunStringLen((x-3)*8, y, va((sf==SLKEY_FRAGLIMIT)?smark:"%s", "fl"), 3); x-=4;}
|
||||
if (sb_showplayers.value) {Draw_FunStringLen((x-5)*8, y, va((sf==SLKEY_NUMPLAYERS)?smark:"%s", "plyrs"), 5); x-=6;}
|
||||
if (sb_showmap.value) {Draw_FunStringLen((x-8)*8, y, va((sf==SLKEY_MAP)?smark:"%s", "map"), 8); x-=9;}
|
||||
if (sb_showgamedir.value) {Draw_FunStringLen((x-8)*8, y, va((sf==SLKEY_GAMEDIR)?smark:"%s", "gamedir"), 8); x-=9;}
|
||||
if (sb_showping.value) {Draw_FunStringLen((x-3)*8, y, va((sf==SLKEY_PING)?smark:"%s", "png"), 3); x-=4;}
|
||||
if (sb_showaddress.value) {Draw_FunStringLen((x-21)*8, y, va((sf==SLKEY_ADDRESS)?smark:"%s", "address"), 21); x-=22;}
|
||||
Draw_FunStringLen(0, y, va((sf==SLKEY_NAME)?smark:"%s", "hostname^7 "), x);
|
||||
}
|
||||
|
||||
qboolean SL_TitlesKey (menucustom_t *ths, menu_t *menu, int key)
|
||||
|
@ -925,8 +931,8 @@ qboolean SL_TitlesKey (menucustom_t *ths, menu_t *menu, int key)
|
|||
do {
|
||||
x = ths->common.width/8;
|
||||
if (mx > x) return false; //out of bounds
|
||||
if (sb_showtimelimit.value) {x-=4;if (mx > x) {sortkey = SLKEY_NAME; break;}}
|
||||
if (sb_showfraglimit.value) {x-=4;if (mx > x) {sortkey = SLKEY_NAME; break;}}
|
||||
if (sb_showtimelimit.value) {x-=4;if (mx > x) {sortkey = SLKEY_TIMELIMIT; break;}}
|
||||
if (sb_showfraglimit.value) {x-=4;if (mx > x) {sortkey = SLKEY_FRAGLIMIT; break;}}
|
||||
if (sb_showplayers.value) {x-=6;if (mx > x) {sortkey = SLKEY_NUMPLAYERS; break;}}
|
||||
if (sb_showmap.value) {x-=9;if (mx > x) {sortkey = SLKEY_MAP; break;}}
|
||||
if (sb_showgamedir.value) {x-=9;if (mx > x) {sortkey = SLKEY_GAMEDIR; break;}}
|
||||
|
@ -935,6 +941,9 @@ qboolean SL_TitlesKey (menucustom_t *ths, menu_t *menu, int key)
|
|||
sortkey = SLKEY_NAME;break;
|
||||
} while (0);
|
||||
|
||||
if (sortkey == SLKEY_ADDRESS)
|
||||
return true;
|
||||
|
||||
Master_SetSortField(sortkey, Master_GetSortField()!=sortkey||!Master_GetSortDescending());
|
||||
return true;
|
||||
}
|
||||
|
@ -1254,7 +1263,16 @@ qboolean SL_ReFilter (menucheck_t *option, menu_t *menu, chk_set_t set)
|
|||
return info->filter[option->bits];
|
||||
case CHK_TOGGLE:
|
||||
if (option->bits>0)
|
||||
{
|
||||
info->filter[option->bits] ^= 1;
|
||||
Cvar_Set(&sb_hidenetquake, info->filter[1]?"0":"1");
|
||||
Cvar_Set(&sb_hidequakeworld, info->filter[2]?"0":"1");
|
||||
Cvar_Set(&sb_hidequake2, info->filter[3]?"0":"1");
|
||||
Cvar_Set(&sb_hidequake3, info->filter[4]?"0":"1");
|
||||
|
||||
Cvar_Set(&sb_hideempty, info->filter[6]?"1":"0");
|
||||
Cvar_Set(&sb_hidefull, info->filter[7]?"1":"0");
|
||||
}
|
||||
|
||||
CalcFilters(menu);
|
||||
|
||||
|
|
|
@ -209,6 +209,10 @@ qboolean Master_ServerIsGreater(serverinfo_t *a, serverinfo_t *b)
|
|||
return Master_CompareInteger(a->maxplayers - a->players, b->maxplayers - b->players, SLIST_TEST_LESS);
|
||||
case SLKEY_BASEGAME:
|
||||
return Master_CompareInteger(a->special, b->special, SLIST_TEST_LESS);
|
||||
case SLKEY_TIMELIMIT:
|
||||
return Master_CompareInteger(a->tl, b->tl, SLIST_TEST_LESS);
|
||||
case SLKEY_FRAGLIMIT:
|
||||
return Master_CompareInteger(a->fl, b->fl, SLIST_TEST_LESS);
|
||||
case SLKEY_MAP:
|
||||
return Master_CompareString(a->map, b->map, SLIST_TEST_LESS);
|
||||
case SLKEY_GAMEDIR:
|
||||
|
@ -245,6 +249,12 @@ qboolean Master_PassesMasks(serverinfo_t *a)
|
|||
case SLKEY_FREEPLAYERS:
|
||||
res = Master_CompareInteger(a->maxplayers-a->players, visrules[i].operandi, visrules[i].compareop);
|
||||
break;
|
||||
case SLKEY_TIMELIMIT:
|
||||
res = Master_CompareInteger(a->tl, visrules[i].operandi, visrules[i].compareop);
|
||||
break;
|
||||
case SLKEY_FRAGLIMIT:
|
||||
res = Master_CompareInteger(a->fl, visrules[i].operandi, visrules[i].compareop);
|
||||
break;
|
||||
|
||||
case SLKEY_MAP:
|
||||
res = Master_CompareString(a->map, visrules[i].operands, visrules[i].compareop);
|
||||
|
@ -426,6 +436,10 @@ float Master_ReadKeyFloat(serverinfo_t *server, int keynum)
|
|||
return server->maxplayers - server->players;
|
||||
case SLKEY_BASEGAME:
|
||||
return server->special;
|
||||
case SLKEY_TIMELIMIT:
|
||||
return server->tl;
|
||||
case SLKEY_FRAGLIMIT:
|
||||
return server->fl;
|
||||
|
||||
default:
|
||||
return atof(Master_ReadKeyString(server, keynum));
|
||||
|
@ -1323,6 +1337,12 @@ void CL_QueryServers(void)
|
|||
static int poll;
|
||||
int op;
|
||||
serverinfo_t *server;
|
||||
|
||||
extern cvar_t sb_hidequake2;
|
||||
extern cvar_t sb_hidequake3;
|
||||
extern cvar_t sb_hidenetquake;
|
||||
extern cvar_t sb_hidequakeworld;
|
||||
|
||||
op = poll;
|
||||
|
||||
|
||||
|
@ -1336,7 +1356,40 @@ void CL_QueryServers(void)
|
|||
|
||||
if (op == 0)
|
||||
{
|
||||
if (server->sends > 0)
|
||||
|
||||
//we only want to send poll packets to servers which will not be filtered (otherwise it's pointless)
|
||||
while(server)
|
||||
{
|
||||
if (server->special & SS_QUAKE3 && !sb_hidequake3.value)
|
||||
break;
|
||||
if (server->special & SS_QUAKE2 && !sb_hidequake2.value)
|
||||
break;
|
||||
if ((server->special & (SS_NETQUAKE|SS_DARKPLACES)) && !sb_hidenetquake.value)
|
||||
break;
|
||||
if ((server->special & (SS_QUAKE3|SS_QUAKE2|SS_DARKPLACES|SS_NETQUAKE))==0 && !sb_hidequakeworld.value)
|
||||
break;
|
||||
server = server->next;
|
||||
poll++;
|
||||
}
|
||||
if (!server)
|
||||
{
|
||||
server = firstserver;
|
||||
while (server)
|
||||
{
|
||||
if (server->special & SS_QUAKE3 && !sb_hidequake3.value)
|
||||
break;
|
||||
if (server->special & SS_QUAKE2 && !sb_hidequake2.value)
|
||||
break;
|
||||
if ((server->special & (SS_NETQUAKE|SS_DARKPLACES)) && !sb_hidenetquake.value)
|
||||
break;
|
||||
if ((server->special & (SS_QUAKE3|SS_QUAKE2|SS_DARKPLACES|SS_NETQUAKE))==0 && !sb_hidequakeworld.value)
|
||||
break;
|
||||
server = server->next;
|
||||
poll++;
|
||||
}
|
||||
|
||||
}
|
||||
if (server && server->sends > 0)
|
||||
{
|
||||
Master_QueryServer(server);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue