]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/serverlist.c
Fix weapon count when there's a complain_weapon (add it only if you don't have it!)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / serverlist.c
index ed68acd713ed1861de710deb46c1fdbe449ba81b..3d848c9c59d78df666d39f87776c7a179363e7bb 100644 (file)
@@ -4,7 +4,7 @@ CLASS(XonoticServerList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticServerList, rowsPerItem, float, 1)
        METHOD(XonoticServerList, draw, void(entity))
        METHOD(XonoticServerList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticServerList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticServerList, keyDown, float(entity, float, float, float))
        METHOD(XonoticServerList, toggleFavorite, void(entity, string))
@@ -49,8 +49,6 @@ CLASS(XonoticServerList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticServerList, infoButton, entity, NULL)
        ATTRIB(XonoticServerList, currentSortOrder, float, 0)
        ATTRIB(XonoticServerList, currentSortField, float, -1)
-       ATTRIB(XonoticServerList, lastClickedServer, float, -1)
-       ATTRIB(XonoticServerList, lastClickedTime, float, 0)
 
        ATTRIB(XonoticServerList, ipAddressBoxFocused, float, -1)
 
@@ -563,6 +561,7 @@ void XonoticServerList_refreshServerList(entity me, float mode)
 }
 void XonoticServerList_focusEnter(entity me)
 {
+       SUPER(XonoticServerList).focusEnter(me);
        if(time < me.nextRefreshTime)
        {
                //print("sorry, no refresh yet\n");
@@ -722,11 +721,7 @@ void XonoticServerList_draw(entity me)
                {
                        if(gethostcachestring(SLIST_FIELD_CNAME, i) == me.selectedServer)
                        {
-                               if(i != me.selectedItem)
-                               {
-                                       me.lastClickedServer = -1;
-                                       me.selectedItem = i;
-                               }
+                               me.selectedItem = i;
                                found = 1;
                                break;
                        }
@@ -949,6 +944,7 @@ void ServerList_Favorite_Click(entity btn, entity me)
        ipstr = netaddress_resolve(me.ipAddressBox.text, 26000);
        if(ipstr != "")
        {
+               m_play_click_sound(MENU_SOUND_SELECT);
                me.toggleFavorite(me, me.ipAddressBox.text);
                me.ipAddressBoxFocused = -1;
        }
@@ -957,18 +953,14 @@ void ServerList_Info_Click(entity btn, entity me)
 {
        if (me.nItems != 0)
                main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
-       DialogOpenButton_Click(me, main.serverInfoDialog);
+
+       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);
+       DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
 }
-void XonoticServerList_clickListBoxItem(entity me, float i, vector where)
+void XonoticServerList_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedServer)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       ServerList_Connect_Click(NULL, me);
-               }
-       me.lastClickedServer = i;
-       me.lastClickedTime = time;
+       ServerList_Connect_Click(NULL, me);
 }
 void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
 {
@@ -1255,6 +1247,7 @@ float XonoticServerList_keyDown(entity me, float scan, float ascii, float shift)
        {
                if(me.nItems != 0)
                {
+                       m_play_click_sound(MENU_SOUND_OPEN);
                        main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
                        DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
                        return 1;