X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fserverlist.qc;h=71119adf121be93f98d50f1df273be17f3415c12;hp=021e9765119d7bf70861a5cdccca8d99c1108280;hb=4e21f418ad9e6287efb942c1fa2861a51981110a;hpb=be37ea91fb3bbd1a6fa4f0b70b32d1ea95343ad4 diff --git a/qcsrc/menu/xonotic/serverlist.qc b/qcsrc/menu/xonotic/serverlist.qc index 021e97651..71119adf1 100644 --- a/qcsrc/menu/xonotic/serverlist.qc +++ b/qcsrc/menu/xonotic/serverlist.qc @@ -8,10 +8,9 @@ void SL_ProcessCategoryOverrides(.string override_field_string, .float override_field) { - string s; for (int i = 0; i < category_ent_count; ++i) { - s = categories[i].override_field_string; + string s = categories[i].override_field_string; if (s != "" && s != categories[i].cat_name) { int catnum = 0; @@ -70,22 +69,19 @@ entity RetrieveCategoryEnt(int catnum) bool IsServerInList(string list, string srv) { - string p; - int i, n; if(srv == "") return false; srv = netaddress_resolve(srv, 26000); if(srv == "") return false; - p = crypto_getidfp(srv); - n = tokenize_console(list); - for(i = 0; i < n; ++i) + string p = crypto_getidfp(srv); + int n = tokenize_console(list); + for(int i = 0; i < n; ++i) { if(substring(argv(i), 0, 1) != "[" && strlen(argv(i)) == 44 && strstrofs(argv(i), ".", 0) < 0) { - if(p) - if(argv(i) == p) - return true; + if(p && argv(i) == p) + return true; } else { @@ -96,7 +92,7 @@ bool IsServerInList(string list, string srv) return false; } -int CheckCategoryOverride(int cat) +int CategoryOverride(int cat) { entity catent = RetrieveCategoryEnt(cat); if(catent) @@ -107,12 +103,12 @@ int CheckCategoryOverride(int cat) } 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; @@ -199,8 +195,6 @@ int CheckCategoryForEntry(int entry) 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": @@ -259,12 +253,12 @@ void ServerList_Update_favoriteButton(entity btn, entity me) entity e = me.favoriteButton; if(IsFavorite(me.ipAddressBox.text)) { - e.setText(e, _("Remove")); - clearTooltip(e); + e.setText(e, ZCTX(_("SERVER^Remove favorite"))); + setZonedTooltip(e, _("Remove the currently highlighted server from bookmarks"), string_null); } else { - e.setText(e, _("Favorite")); + e.setText(e, ZCTX(_("SERVER^Favorite"))); setZonedTooltip(e, _("Bookmark the currently highlighted server so that it's faster to find in the future"), string_null); } } @@ -314,14 +308,10 @@ void XonoticServerList_refreshServerList(entity me, int mode) if(mode >= REFRESHSERVERLIST_REFILTER) { - float m; - int i, n; - int listflags = 0; - string s, typestr, modstr; - - s = me.filterString; + string s = me.filterString; - m = strstrofs(s, ":", 0); + string typestr; + int m = strstrofs(s, ":", 0); if(m >= 0) { typestr = substring(s, 0, m); @@ -332,7 +322,7 @@ void XonoticServerList_refreshServerList(entity me, int mode) else typestr = ""; - modstr = cvar_string("menu_slist_modfilter"); + string modstr = cvar_string("menu_slist_modfilter"); m = SLIST_MASK_AND - 1; resethostcachemasks(); @@ -351,6 +341,10 @@ void XonoticServerList_refreshServerList(entity me, int mode) if(!me.filterShowEmpty) sethostcachemasknumber(++m, SLIST_FIELD_NUMHUMANS, 1, SLIST_TEST_GREATEREQUAL); + // show laggy button + if(!me.filterShowLaggy && autocvar_menu_slist_maxping > 0) + sethostcachemasknumber(++m, SLIST_FIELD_PING, autocvar_menu_slist_maxping, SLIST_TEST_LESSEQUAL); + // gametype filtering if(typestr != "") sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(typestr, ":"), SLIST_TEST_STARTSWITH); @@ -365,8 +359,8 @@ void XonoticServerList_refreshServerList(entity me, int mode) } // 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); @@ -379,11 +373,11 @@ void XonoticServerList_refreshServerList(entity me, int mode) 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(); @@ -404,8 +398,7 @@ void XonoticServerList_focusEnter(entity me) void XonoticServerList_draw(entity me) { - int i; - bool found = false, owned; + me.serversHeight = (autocvar_menu_slist_categories > 0 ? 1.0 : me.categoriesHeight); if(_Nex_ExtResponseSystem_BannedServersNeedsRefresh) { @@ -448,9 +441,9 @@ void XonoticServerList_draw(entity me) 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 @@ -541,11 +534,12 @@ void XonoticServerList_draw(entity me) } 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) @@ -559,7 +553,7 @@ void XonoticServerList_draw(entity me) } 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) { @@ -635,7 +629,7 @@ void ServerList_TypeSort_Click(entity btn, entity me) // the type was found // choose the next one flag = true; - s = MapInfo_Type_ToString(Gametypes_from(it.m_id + 1)); + s = MapInfo_Type_ToString(REGISTRY_GET(Gametypes, it.m_id + 1)); if (s == "") s = MapInfo_Type_ToString(first); break; }); @@ -691,6 +685,15 @@ void ServerList_ShowFull_Click(entity box, entity me) me.ipAddressBox.cursorPos = 0; me.ipAddressBoxFocused = -1; } +void ServerList_ShowLaggy_Click(entity box, entity me) +{ + box.setChecked(box, me.filterShowLaggy = !me.filterShowLaggy); + me.refreshServerList(me, REFRESHSERVERLIST_REFILTER); + + me.ipAddressBox.setText(me.ipAddressBox, ""); + me.ipAddressBox.cursorPos = 0; + me.ipAddressBoxFocused = -1; +} void XonoticServerList_setSortOrder(entity me, int fld, int direction) { if(me.currentSortField == fld) @@ -708,13 +711,11 @@ void XonoticServerList_setSortOrder(entity me, int fld, int direction) } 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; @@ -759,10 +760,8 @@ void XonoticServerList_resizeNotify(entity me, vector relOrigin, vector relSize, } 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) { @@ -778,8 +777,10 @@ void ServerList_Info_Click(entity btn, entity me) if (me.nItems != 0) main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem); - vector org = boxToGlobal(eY * (me.selectedItem * me.itemHeight - me.scrollPos), me.origin, me.size); - vector sz = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size); + float thisPos = me.getItemStart(me, me.selectedItem); + float thisHeight = me.getItemHeight(me, me.selectedItem); + vector org = boxToGlobal(eY * (thisPos - me.scrollPos), me.origin, me.size); + vector sz = boxToGlobalSize(eY * thisHeight + eX * (1 - me.controlWidth), me.size); DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz); } void XonoticServerList_doubleClickListBoxItem(entity me, int i, vector where) @@ -788,33 +789,22 @@ void XonoticServerList_doubleClickListBoxItem(entity me, int i, vector where) } void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused) { - // layout: Ping, Server name, Map name, NP, TP, MP - float p; - int q; - bool isv4, isv6; - vector theColor; - float theAlpha; - bool pure = false, pure_available = false; - int freeslots = -1, sflags = -1, j, m; - string s, typestr, versionstr, k, v, modname; - - //printf("time: %f, i: %d, item: %d, nitems: %d\n", time, i, item, me.nItems); - vector oldscale = draw_scale; vector oldshift = draw_shift; #define SET_YRANGE(start,end) \ - draw_scale = boxToGlobalSize(eX + eY * (end - start), oldscale); \ - draw_shift = boxToGlobal(eY * start, oldshift, oldscale); + draw_scale = boxToGlobalSize(eX + eY * ((end) - (start)), oldscale); \ + draw_shift = boxToGlobal(eY * (start), oldshift, oldscale); - for (j = 0; j < category_draw_count; ++j) { + int c; + for (c = 0; c < category_draw_count; ++c) { // Matches exactly the headings with increased height. - if (i == category_item[j]) + if (i == category_item[c]) break; } - if (j < category_draw_count) + if (c < category_draw_count) { - entity catent = RetrieveCategoryEnt(category_name[j]); + entity catent = RetrieveCategoryEnt(category_name[c]); if(catent) { SET_YRANGE( @@ -840,6 +830,10 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is } } + // Now categories are done. Set the Y range in stone. + oldscale = draw_scale; + oldshift = draw_shift; + if(isSelected && !me.lockedSelectedItem) draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED); else if(isFocused) @@ -848,33 +842,34 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha); } - s = gethostcachestring(SLIST_FIELD_QCSTATUS, i); - m = tokenizebyseparator(s, ":"); - typestr = ""; + string s = gethostcachestring(SLIST_FIELD_QCSTATUS, i); + int m = tokenizebyseparator(s, ":"); + string typestr = "", versionstr = ""; if(m >= 2) { typestr = argv(0); versionstr = argv(1); } - freeslots = -1; - modname = ""; - for(j = 2; j < m; ++j) + bool pure = false, pure_available = false; + int freeslots = -1, sflags = -1; + string modname = ""; + for(int j = 2; j < m; ++j) { if(argv(j) == "") break; - k = substring(argv(j), 0, 1); - v = substring(argv(j), 1, -1); - if(k == "P") + string key = substring(argv(j), 0, 1); + string value = substring(argv(j), 1, -1); + if(key == "P") { - pure = (stof(v) == 0); + pure = (stof(value) == 0); pure_available = true; } - else if(k == "S") - freeslots = stof(v); - else if(k == "F") - sflags = stoi(v); - else if(k == "M") - modname = v; + else if(key == "S") + freeslots = stof(value); + else if(key == "F") + sflags = stoi(value); + else if(key == "M") + modname = value; } #ifdef COMPAT_NO_MOD_IS_XONOTIC @@ -901,6 +896,7 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is if(modname != "newtoys") pure_available = false; + float theAlpha; if(gethostcachenumber(SLIST_FIELD_FREESLOTS, i) <= 0) theAlpha = SKINALPHA_SERVERLIST_FULL; else if(freeslots == 0) @@ -910,18 +906,19 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is else theAlpha = 1; - p = gethostcachenumber(SLIST_FIELD_PING, i); + float ping = gethostcachenumber(SLIST_FIELD_PING, i); const int PING_LOW = 75; const int PING_MED = 200; const int PING_HIGH = 500; - if(p < PING_LOW) - theColor = SKINCOLOR_SERVERLIST_LOWPING + (SKINCOLOR_SERVERLIST_MEDPING - SKINCOLOR_SERVERLIST_LOWPING) * (p / PING_LOW); - else if(p < PING_MED) - theColor = SKINCOLOR_SERVERLIST_MEDPING + (SKINCOLOR_SERVERLIST_HIGHPING - SKINCOLOR_SERVERLIST_MEDPING) * ((p - PING_LOW) / (PING_MED - PING_LOW)); - else if(p < PING_HIGH) + vector theColor; + if(ping < PING_LOW) + theColor = SKINCOLOR_SERVERLIST_LOWPING + (SKINCOLOR_SERVERLIST_MEDPING - SKINCOLOR_SERVERLIST_LOWPING) * (ping / PING_LOW); + else if(ping < PING_MED) + theColor = SKINCOLOR_SERVERLIST_MEDPING + (SKINCOLOR_SERVERLIST_HIGHPING - SKINCOLOR_SERVERLIST_MEDPING) * ((ping - PING_LOW) / (PING_MED - PING_LOW)); + else if(ping < PING_HIGH) { theColor = SKINCOLOR_SERVERLIST_HIGHPING; - theAlpha *= 1 + (SKINALPHA_SERVERLIST_HIGHPING - 1) * ((p - PING_MED) / (PING_HIGH - PING_MED)); + theAlpha *= 1 + (SKINALPHA_SERVERLIST_HIGHPING - 1) * ((ping - PING_MED) / (PING_HIGH - PING_MED)); } else { @@ -937,7 +934,7 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is s = gethostcachestring(SLIST_FIELD_CNAME, i); - isv4 = isv6 = false; + bool isv4 = false, isv6 = false; if(substring(s, 0, 1) == "[") { isv6 = true; @@ -949,27 +946,27 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is me.seenIPv4 += 1; } - q = stof(substring(crypto_getencryptlevel(s), 0, 1)); - if((q <= 0 && cvar("crypto_aeslevel") >= 3) || (q >= 3 && cvar("crypto_aeslevel") <= 0)) + int crypto = stof(substring(crypto_getencryptlevel(s), 0, 1)); + if((crypto <= 0 && cvar("crypto_aeslevel") >= 3) || (crypto >= 3 && cvar("crypto_aeslevel") <= 0)) { theColor = SKINCOLOR_SERVERLIST_IMPOSSIBLE; theAlpha = SKINALPHA_SERVERLIST_IMPOSSIBLE; } - if(q == 1) + if(crypto == 1) { if(cvar("crypto_aeslevel") >= 2) - q |= 4; + crypto |= 4; } - if(q == 2) + if(crypto == 2) { if(cvar("crypto_aeslevel") >= 1) - q |= 4; + crypto |= 4; } - if(q == 3) - q = 5; - else if(q >= 3) - q -= 2; + if(crypto == 3) + crypto = 5; + else if(crypto >= 3) + crypto -= 2; // possible status: // 0: crypto off // 1: AES possible @@ -983,7 +980,7 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is // -------------- vector iconSize = '0 0 0'; iconSize_y = me.realFontSize.y * me.iconsSizeFactor; - iconSize_x = me.realFontSize.x * me.iconsSizeFactor; + iconSize_x = me.realFontSize.x * me.iconsSizeFactor * me.serversHeight; vector iconPos = '0 0 0'; iconPos_x = (me.columnIconsSize - 3 * iconSize.x) * 0.5; @@ -1001,8 +998,8 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is iconPos.x += iconSize.x; // AES - if(q > 0) - draw_Picture(iconPos, strcat("icon_aeslevel", ftos(q)), iconSize, '1 1 1', 1); + if(crypto > 0) + draw_Picture(iconPos, strcat("icon_aeslevel", ftos(crypto)), iconSize, '1 1 1', 1); iconPos.x += iconSize.x; @@ -1040,7 +1037,7 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is string t = ""; if(me.seenIPv4 && me.seenIPv6) t = strcat(t, (isv6) ? "IPv6, " : "IPv4, "); - t = strcat(t, _("encryption:"), " ", (q ? sprintf(_("AES level %d"), q) : ZCTX(_("ENC^none"))), ", "); + t = strcat(t, _("encryption:"), " ", (crypto ? sprintf(_("AES level %d"), crypto) : ZCTX(_("ENC^none"))), ", "); t = strcat(t, sprintf(_("mod: %s"), ((modname == "xonotic") ? ZCTX(_("MOD^Default")) : original_modname))); if(pure_available) t = strcat(t, sprintf(" (%s)", (pure) ? _("official settings") : _("modified settings"))); @@ -1052,8 +1049,14 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is // RENDER TEXT // -------------- + // Center it in the row. + SET_YRANGE( + 0.5 - 0.5 / me.serversHeight, + 0.5 + 0.5 / me.serversHeight + ); + // ping - s = ftos(p); + s = ftos(ping); draw_Text(me.realUpperMargin * eY + (me.columnPingOrigin + me.columnPingSize - draw_TextWidth(s, 0, me.realFontSize)) * eX, s, me.realFontSize, theColor, theAlpha, 0); // server name @@ -1104,8 +1107,10 @@ bool XonoticServerList_keyDown(entity me, int scan, bool ascii, bool shift) { if(me.nItems != 0) { - vector org = boxToGlobal(eY * (me.selectedItem * me.itemHeight - me.scrollPos), me.origin, me.size); - vector sz = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size); + float thisPos = me.getItemStart(me, me.selectedItem); + float thisHeight = me.getItemHeight(me, me.selectedItem); + vector org = boxToGlobal(eY * (thisPos - me.scrollPos), me.origin, me.size); + vector sz = boxToGlobalSize(eY * thisHeight + eX * (1 - me.controlWidth), me.size); m_play_click_sound(MENU_SOUND_OPEN); main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem); DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz); @@ -1135,44 +1140,41 @@ float XonoticServerList_getTotalHeight(entity me) { float num_normal_rows = me.nItems; int num_headers = category_draw_count; - return me.itemHeight * (num_normal_rows + me.categoriesHeight * num_headers); + return me.itemHeight * (me.serversHeight * num_normal_rows + me.categoriesHeight * num_headers); } 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) - return itemidx + 1 + floor(pos - (itempos + me.categoriesHeight + 1)); + float itempos = i * me.categoriesHeight + category_item[i] * me.serversHeight; + if (pos >= itempos + me.categoriesHeight + me.serversHeight) + return itemidx + 1 + floor((pos - (itempos + me.categoriesHeight + me.serversHeight)) / me.serversHeight); if (pos >= itempos) return itemidx; } // No category matches? Note that category 0 is... 0. Therefore no headings exist at all. - return floor(pos); + return floor(pos / me.serversHeight); } 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]; + float itempos = i * me.categoriesHeight + category_item[i] * me.serversHeight; if (item >= itemidx + 1) - return (itempos + me.categoriesHeight + 1 + item - (itemidx + 1)) * me.itemHeight; + return (itempos + me.categoriesHeight + (1 + item - (itemidx + 1)) * me.serversHeight) * me.itemHeight; if (item >= itemidx) return itempos * me.itemHeight; } // No category matches? Note that category 0 is... 0. Therefore no headings exist at all. - return item * me.itemHeight; + return item * me.serversHeight * me.itemHeight; } 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); } - return me.itemHeight; + return me.itemHeight * me.serversHeight; }