void ServerList_Filter_Change(entity box, entity me);
void ServerList_Favorite_Click(entity btn, entity me);
void ServerList_Info_Click(entity btn, entity me);
+void ServerList_Update_favoriteButton(entity btn, entity me);
#endif
#ifdef IMPLEMENTATION
resorthostcache();
}
+void ServerList_Update_favoriteButton(entity btn, entity me)
+{
+ if(IsFavorite(me.ipAddressBox.text))
+ me.favoriteButton.setText(me.favoriteButton, _("Remove"));
+ else
+ me.favoriteButton.setText(me.favoriteButton, _("Bookmark"));
+}
+
entity makeXonoticServerList()
{
entity me;
}
else */
{
- float m, o;
+ float m, o, i, n; // moin moin
string s, typestr, modstr;
s = me.filterString;
m = SLIST_MASK_AND - 1;
resethostcachemasks();
+
+ // ping: reject negative ping (no idea why this happens in the first place, engine bug)
+ sethostcachemasknumber(++m, SLIST_FIELD_PING, 0, SLIST_TEST_GREATEREQUAL);
+
+ // show full button
if(!me.filterShowFull)
- sethostcachemasknumber(++m, SLIST_FIELD_FREESLOTS, 1, SLIST_TEST_GREATEREQUAL);
+ {
+ sethostcachemasknumber(++m, SLIST_FIELD_FREESLOTS, 1, SLIST_TEST_GREATEREQUAL); // legacy
+ sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, ":S0:", SLIST_TEST_NOTCONTAIN); // g_maxplayers support
+ }
+
+ // show empty button
if(!me.filterShowEmpty)
sethostcachemasknumber(++m, SLIST_FIELD_NUMHUMANS, 1, SLIST_TEST_GREATEREQUAL);
+
+ // gametype filtering
if(typestr != "")
sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(typestr, ":"), SLIST_TEST_STARTSWITH);
+
+ // mod filtering
if(modstr != "")
{
if(substring(modstr, 0, 1) == "!")
else
sethostcachemaskstring(++m, SLIST_FIELD_MOD, resolvemod(modstr), SLIST_TEST_EQUAL);
}
+
+ // server banning
+ n = tokenizebyseparator(_Nex_ExtResponseSystem_BannedServers, " ");
+ for(i = 0; i < n; ++i)
+ sethostcachemaskstring(++m, SLIST_FIELD_CNAME, argv(i), SLIST_TEST_NOTEQUAL);
+
m = SLIST_MASK_OR - 1;
if(s != "")
{
me.connectButton.disabled = ((me.nItems == 0) && (me.ipAddressBox.text == ""));
me.infoButton.disabled = ((me.nItems == 0) || !owned);
+ me.favoriteButton.disabled = ((me.nItems == 0) && (me.ipAddressBox.text == ""));
found = 0;
if(me.selectedServer)
if(me.ipAddressBoxFocused != me.ipAddressBox.focused)
{
if(me.ipAddressBox.focused || me.ipAddressBoxFocused < 0)
- {
- if(IsFavorite(me.ipAddressBox.text))
- me.favoriteButton.setText(me.favoriteButton, _("Remove"));
- else
- me.favoriteButton.setText(me.favoriteButton, _("Bookmark"));
- }
+ ServerList_Update_favoriteButton(NULL, me);
me.ipAddressBoxFocused = me.ipAddressBox.focused;
}
me.ipAddressBox.cursorPos = 0;
me.ipAddressBoxFocused = -1;
}
-void XonoticServerList_setSortOrder(entity me, float field, float direction)
+void XonoticServerList_setSortOrder(entity me, float fld, float direction)
{
- if(me.currentSortField == field)
+ if(me.currentSortField == fld)
direction = -me.currentSortOrder;
me.currentSortOrder = direction;
- me.currentSortField = field;
- me.sortButton1.forcePressed = (field == SLIST_FIELD_PING);
- me.sortButton2.forcePressed = (field == SLIST_FIELD_NAME);
- me.sortButton3.forcePressed = (field == SLIST_FIELD_MAP);
+ me.currentSortField = fld;
+ me.sortButton1.forcePressed = (fld == SLIST_FIELD_PING);
+ me.sortButton2.forcePressed = (fld == SLIST_FIELD_NAME);
+ me.sortButton3.forcePressed = (fld == SLIST_FIELD_MAP);
me.sortButton4.forcePressed = 0;
- me.sortButton5.forcePressed = (field == SLIST_FIELD_NUMHUMANS);
+ me.sortButton5.forcePressed = (fld == SLIST_FIELD_NUMHUMANS);
me.selectedItem = 0;
if(me.selectedServer)
strunzone(me.selectedServer);
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
- if(gethostcachenumber(SLIST_FIELD_NUMPLAYERS, i) >= gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i))
+ if(gethostcachenumber(SLIST_FIELD_FREESLOTS, i) <= 0)
theAlpha = SKINALPHA_SERVERLIST_FULL;
+ else if(strstrofs(gethostcachestring(SLIST_FIELD_QCSTATUS, i), ":S0:", 0) >= 0)
+ theAlpha = SKINALPHA_SERVERLIST_FULL; // g_maxplayers support
else if not(gethostcachenumber(SLIST_FIELD_NUMHUMANS, i))
theAlpha = SKINALPHA_SERVERLIST_EMPTY;
else