return false;
}
-int CheckCategoryOverride(int cat)
+int CategoryOverride(int cat)
{
entity catent = RetrieveCategoryEnt(cat);
if(catent)
}
else
{
- error(sprintf("CheckCategoryOverride(%d): Improper category number!\n", cat));
+ error(sprintf("CategoryOverride(%d): Improper category number!\n", cat));
return cat;
}
}
-int CheckCategoryForEntry(int entry)
+int CategoryForEntry(int entry)
{
string s, k, v, modtype = "";
int j, m, impure = 0, freeslots = 0, sflags = 0;
case "minstagib":
case "instagib": { return CAT_INSTAGIB; }
case "overkill": { return CAT_OVERKILL; }
- //case "nix": { return CAT_NIX; }
- //case "newtoys": { return CAT_NEWTOYS; }
// "cts" is allowed as compat, xdf is replacement
case "cts":
entity e = me.favoriteButton;
if(IsFavorite(me.ipAddressBox.text))
{
- e.setText(e, _("Remove"));
- clearTooltip(e);
+ e.setText(e, _("Remove favorite"));
+ setZonedTooltip(e, _("Remove the currently highlighted server from bookmarks"), string_null);
}
else
{
if(mode >= REFRESHSERVERLIST_REFILTER)
{
- float m;
- int i, n;
- int listflags = 0;
- string s, typestr, modstr;
+ string s = me.filterString;
- s = me.filterString;
-
- m = strstrofs(s, ":", 0);
+ string typestr;
+ int m = strstrofs(s, ":", 0);
if(m >= 0)
{
typestr = substring(s, 0, m);
else
typestr = "";
- modstr = cvar_string("menu_slist_modfilter");
+ string modstr = cvar_string("menu_slist_modfilter");
m = SLIST_MASK_AND - 1;
resethostcachemasks();
}
// server banning
- n = tokenizebyseparator(_Nex_ExtResponseSystem_BannedServers, " ");
- for(i = 0; i < n; ++i)
+ int n = tokenizebyseparator(_Nex_ExtResponseSystem_BannedServers, " ");
+ for(int i = 0; i < n; ++i)
if(argv(i) != "")
sethostcachemaskstring(++m, SLIST_FIELD_CNAME, argv(i), SLIST_TEST_NOTSTARTSWITH);
sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(s, ":"), SLIST_TEST_STARTSWITH);
}
- // sorting flags
- //listflags |= SLSF_FAVORITES;
- listflags |= SLSF_CATEGORIES;
- if(me.currentSortOrder < 0) { listflags |= SLSF_DESCENDING; }
- sethostcachesort(me.currentSortField, listflags);
+ int sorting_flags = 0;
+ //sorting_flags |= SLSF_FAVORITES;
+ sorting_flags |= SLSF_CATEGORIES;
+ if(me.currentSortOrder < 0) { sorting_flags |= SLSF_DESCENDING; }
+ sethostcachesort(me.currentSortField, sorting_flags);
}
resorthostcache();
void XonoticServerList_draw(entity me)
{
- int i;
- bool found = false, owned;
-
if(_Nex_ExtResponseSystem_BannedServersNeedsRefresh)
{
if(!me.needsRefresh)
me.refreshServerList(me, REFRESHSERVERLIST_RESORT);
}
- owned = ((me.selectedServer == me.ipAddressBox.text) && (me.ipAddressBox.text != ""));
+ bool owned = ((me.selectedServer == me.ipAddressBox.text) && (me.ipAddressBox.text != ""));
- for(i = 0; i < category_draw_count; ++i) { category_name[i] = -1; category_item[i] = -1; }
+ for(int i = 0; i < category_draw_count; ++i) { category_name[i] = -1; category_item[i] = -1; }
category_draw_count = 0;
if(autocvar_menu_slist_categories >= 0) // if less than 0, don't even draw a category heading for favorites
}
else { me.nItems = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT); }
- me.connectButton.disabled = (me.lockedSelectedItem || (me.nItems == 0 && me.ipAddressBox.text == ""));
+ me.connectButton.disabled = (me.ipAddressBox.text == "");
//me.disconnectButton.disabled = (!(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)));
- me.infoButton.disabled = (me.lockedSelectedItem || me.nItems == 0 || !owned);
- me.favoriteButton.disabled = (me.lockedSelectedItem || (me.nItems == 0 && me.ipAddressBox.text == ""));
+ me.infoButton.disabled = !owned;
+ me.favoriteButton.disabled = (me.ipAddressBox.text == "");
+ bool found = false;
if(me.lockedSelectedItem)
{
if(me.nItems > 0)
}
else if(me.selectedServer)
{
- for(i = 0; i < me.nItems; ++i)
+ for(int i = 0; i < me.nItems; ++i)
{
if(gethostcachestring(SLIST_FIELD_CNAME, i) == me.selectedServer)
{
}
void XonoticServerList_positionSortButton(entity me, entity btn, float theOrigin, float theSize, string theTitle, void(entity, entity) theFunc)
{
- vector originInLBSpace, sizeInLBSpace;
- originInLBSpace = eY * (-me.itemHeight);
- sizeInLBSpace = eY * me.itemHeight + eX * (1 - me.controlWidth);
+ vector originInLBSpace = eY * (-me.itemHeight);
+ vector sizeInLBSpace = eY * me.itemHeight + eX * (1 - me.controlWidth);
- vector originInDialogSpace, sizeInDialogSpace;
- originInDialogSpace = boxToGlobal(originInLBSpace, me.Container_origin, me.Container_size);
- sizeInDialogSpace = boxToGlobalSize(sizeInLBSpace, me.Container_size);
+ vector originInDialogSpace = boxToGlobal(originInLBSpace, me.Container_origin, me.Container_size);
+ vector sizeInDialogSpace = boxToGlobalSize(sizeInLBSpace, me.Container_size);
btn.Container_origin_x = originInDialogSpace.x + sizeInDialogSpace.x * theOrigin;
btn.Container_size_x = sizeInDialogSpace.x * theSize;
}
void ServerList_Connect_Click(entity btn, entity me)
{
- if (me.lockedSelectedItem)
- return;
- string sv = (me.ipAddressBox.text != "") ? me.ipAddressBox.text : me.selectedServer;
- localcmd(sprintf("connect %s\n", sv));
+ if (me.ipAddressBox.text != "")
+ localcmd(sprintf("connect %s\n", me.ipAddressBox.text));
}
void ServerList_Favorite_Click(entity btn, entity this)
{
int XonoticServerList_getItemAtPos(entity me, float pos)
{
pos = pos / me.itemHeight;
- int i;
- for (i = category_draw_count - 1; i >= 0; --i) {
+ for (int i = category_draw_count - 1; i >= 0; --i) {
int itemidx = category_item[i];
float itempos = i * me.categoriesHeight + category_item[i];
if (pos >= itempos + me.categoriesHeight + 1)
}
float XonoticServerList_getItemStart(entity me, int item)
{
- int i;
- for (i = category_draw_count - 1; i >= 0; --i) {
+ for (int i = category_draw_count - 1; i >= 0; --i) {
int itemidx = category_item[i];
float itempos = i * me.categoriesHeight + category_item[i];
if (item >= itemidx + 1)
}
float XonoticServerList_getItemHeight(entity me, int item)
{
- int i;
- for (i = 0; i < category_draw_count; ++i) {
+ for (int i = 0; i < category_draw_count; ++i) {
// Matches exactly the headings with increased height.
if (item == category_item[i])
return me.itemHeight * (me.categoriesHeight + 1);