]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/serverlist.c
Merge remote-tracking branch 'origin/samual/serverlist'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / serverlist.c
index 795e68a4bdfa2c7c8eaaa8b05663d13e6be91ad6..e2a0e6c1249f401847c51e27b40ebef94bd935cd 100644 (file)
@@ -49,7 +49,6 @@ CLASS(XonoticServerList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticServerList, infoButton, entity, NULL)
        ATTRIB(XonoticServerList, currentSortOrder, float, 0)
        ATTRIB(XonoticServerList, currentSortField, float, -1)
-       ATTRIB(XonoticServerList, lastBumpSelectTime, float, 0)
        ATTRIB(XonoticServerList, lastClickedServer, float, -1)
        ATTRIB(XonoticServerList, lastClickedTime, float, 0)
 
@@ -67,16 +66,15 @@ ENDCLASS(XonoticServerList)
 entity makeXonoticServerList();
 
 #ifndef IMPLEMENTATION
-var float autocvar_menu_slist_categories = TRUE;
-var float autocvar_menu_slist_categories_onlyifmultiple = TRUE; 
-var float autocvar_menu_slist_purethreshold = 10;
-var float autocvar_menu_slist_modimpurity = 10;
-var float autocvar_menu_slist_recommendations = 3;
-var float autocvar_menu_slist_recommendations_maxping = 150;
-var float autocvar_menu_slist_recommendations_minfreeslots = 1; 
-var float autocvar_menu_slist_recommendations_minhumans = 0;
-var float autocvar_menu_slist_recommendations_purethreshold = -1; 
-//var string autocvar_menu_slist_recommended = "76.124.107.5:26004";
+float autocvar_menu_slist_categories;
+float autocvar_menu_slist_categories_onlyifmultiple; 
+float autocvar_menu_slist_purethreshold;
+float autocvar_menu_slist_modimpurity;
+float autocvar_menu_slist_recommendations;
+float autocvar_menu_slist_recommendations_maxping;
+float autocvar_menu_slist_recommendations_minfreeslots; 
+float autocvar_menu_slist_recommendations_minhumans;
+float autocvar_menu_slist_recommendations_purethreshold; 
 
 // server cache fields
 #define SLIST_FIELDS \
@@ -107,13 +105,13 @@ const float REFRESHSERVERLIST_ASK = 2;       // ..., also suggest querying serve
 const float REFRESHSERVERLIST_RESET = 3;     // ..., also clear the list first
 
 // function declarations
-entity RetrieveCategoryEnt(float catnum);
-
 float IsServerInList(string list, string srv);
 #define IsFavorite(srv) IsServerInList(cvar_string("net_slist_favorites"), srv)
 #define IsPromoted(srv) IsServerInList(_Nex_ExtResponseSystem_PromotedServers, srv)
 #define IsRecommended(srv) IsServerInList(_Nex_ExtResponseSystem_RecommendedServers, srv)
 
+entity RetrieveCategoryEnt(float catnum);
+
 float CheckCategoryOverride(float cat);
 float CheckCategoryForEntry(float entry); 
 float m_gethostcachecategory(float entry) { return CheckCategoryOverride(CheckCategoryForEntry(entry)); }
@@ -148,7 +146,7 @@ float category_draw_count;
 
 #define SLIST_CATEGORIES \
        SLIST_CATEGORY(CAT_FAVORITED,    "",            "",             ZCTX(_("SLCAT^Favorites"))) \
-       SLIST_CATEGORY(CAT_RECOMMENDED,  "",            "CAT_SERVERS",  ZCTX(_("SLCAT^Recommended"))) \
+       SLIST_CATEGORY(CAT_RECOMMENDED,  "",            "",             ZCTX(_("SLCAT^Recommended"))) \
        SLIST_CATEGORY(CAT_NORMAL,       "",            "CAT_SERVERS",  ZCTX(_("SLCAT^Normal Servers"))) \
        SLIST_CATEGORY(CAT_SERVERS,      "CAT_NORMAL",  "CAT_SERVERS",  ZCTX(_("SLCAT^Servers"))) \
        SLIST_CATEGORY(CAT_XPM,          "CAT_NORMAL",  "CAT_SERVERS",  ZCTX(_("SLCAT^Competitive Mode"))) \
@@ -416,7 +414,7 @@ void XonoticServerList_toggleFavorite(entity me, string srv)
                f = 1;
                --i;
        }
-       
+
        if(!f)
        {
                s1 = "";
@@ -1079,7 +1077,7 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float
                theAlpha = SKINALPHA_SERVERLIST_FULL;
        else if(freeslots == 0)
                theAlpha = SKINALPHA_SERVERLIST_FULL; // g_maxplayers support
-       else if not(gethostcachenumber(SLIST_FIELD_NUMHUMANS, i))
+       else if (!gethostcachenumber(SLIST_FIELD_NUMHUMANS, i))
                theAlpha = SKINALPHA_SERVERLIST_EMPTY;
        else
                theAlpha = 1;
@@ -1165,7 +1163,7 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float
 
        string n;
 
-       if not(me.seenIPv4 && me.seenIPv6)
+       if (!(me.seenIPv4 && me.seenIPv6))
        {
                iconPos_x += iconSize_x * 0.5;
        }
@@ -1242,14 +1240,11 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float
 
 float XonoticServerList_keyDown(entity me, float scan, float ascii, float shift)
 {
-       float i = me.selectedItem;
        vector org, sz;
 
        org = boxToGlobal(eY * (me.selectedItem * me.itemHeight - me.scrollPos), me.origin, me.size);
        sz = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size);
 
-       me.lastBumpSelectTime = 0;
-
        if(scan == K_ENTER || scan == K_KP_ENTER)
        {
                ServerList_Connect_Click(NULL, me);
@@ -1259,7 +1254,7 @@ float XonoticServerList_keyDown(entity me, float scan, float ascii, float shift)
        {
                if(me.nItems != 0)
                {
-                       main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, i);
+                       main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
                        DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
                        return 1;
                }