]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make work better some lists
authorterencehill <piuntn@gmail.com>
Sat, 25 Jul 2015 13:44:42 +0000 (15:44 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 25 Jul 2015 13:44:42 +0000 (15:44 +0200)
qcsrc/menu/xonotic/languagelist.qc
qcsrc/menu/xonotic/serverlist.qc
qcsrc/menu/xonotic/skinlist.qc
qcsrc/menu/xonotic/weaponslist.qc

index af9d75211b3987809ec4bedb3eff1e85d3813990..4ff17755679258c1404b25954ad56ba0fe0df925 100644 (file)
@@ -121,17 +121,17 @@ void XonoticLanguageList_loadCvars(entity me)
        {
                if(me.languageParameter(me, i, LANGPARM_ID) == "en")
                {
-                       me.selectedItem = i;
+                       SUPER(XonoticLanguageList).setSelected(me, i);
                        break;
                }
        }
 
-        // otherwise, find the language
+       // otherwise, find the language
        for(i = 0; i < n; ++i)
        {
                if(me.languageParameter(me, i, LANGPARM_ID) == s)
                {
-                       me.selectedItem = i;
+                       SUPER(XonoticLanguageList).setSelected(me, i);
                        break;
                }
        }
index 8bf70cc33307d06fe1ae5130649d602a8ef164fc..f2b01c6fbc5fcb1c5cc0c187fc5d367257b405e2 100644 (file)
@@ -723,6 +723,7 @@ void XonoticServerList_draw(entity me)
                {
                        if(gethostcachestring(SLIST_FIELD_CNAME, i) == me.selectedServer)
                        {
+                               // don't follow the selected item with SUPER(XonoticServerList).setSelected(me, i);
                                me.selectedItem = i;
                                found = true;
                                break;
@@ -733,8 +734,9 @@ void XonoticServerList_draw(entity me)
        {
                if(me.nItems > 0)
                {
+                       // selected server disappeared, select the last server (scrolling to it)
                        if(me.selectedItem >= me.nItems)
-                               me.selectedItem = me.nItems - 1;
+                               SUPER(XonoticServerList).setSelected(me, me.nItems - 1);
                        if(me.selectedServer)
                                strunzone(me.selectedServer);
                        me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
index 7400b379f6c52fca110bb8387b7b9b21ef4845df..d505a2894e4790050dfba4cce9c85d368cc31641 100644 (file)
@@ -66,7 +66,7 @@ void XonoticSkinList_loadCvars(entity me)
        {
                if(me.skinParameter(me, i, SKINPARM_NAME) == s)
                {
-                       me.selectedItem = i;
+                       me.setSelected(me, i);
                        break;
                }
        }
index adc7fc2115bb4634dbae79b6fab9236d286fa05b..f4bcf4feae2e15d09504cd0dbb7e21fbe089e4ea 100644 (file)
@@ -46,7 +46,7 @@ void WeaponsList_MoveUp_Click(entity box, entity me)
        if(me.selectedItem > 0)
        {
                cvar_set("cl_weaponpriority", swapInPriorityList(cvar_string("cl_weaponpriority"), me.selectedItem - 1, me.selectedItem));
-               me.selectedItem -= 1;
+               me.setSelected(me, me.selectedItem - 1);
        }
 }
 void WeaponsList_MoveDown_Click(entity box, entity me)
@@ -54,7 +54,7 @@ void WeaponsList_MoveDown_Click(entity box, entity me)
        if(me.selectedItem < me.nItems - 1)
        {
                cvar_set("cl_weaponpriority", swapInPriorityList(cvar_string("cl_weaponpriority"), me.selectedItem, me.selectedItem + 1));
-               me.selectedItem += 1;
+               me.setSelected(me, me.selectedItem + 1);
        }
 }
 void XonoticWeaponsList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)