From: terencehill Date: Sat, 25 Jul 2015 13:44:42 +0000 (+0200) Subject: Make work better some lists X-Git-Tag: xonotic-v0.8.1~11^2~13 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ca144cbc90a2d0241f19dd3373f53bd31e8e7d6a;p=xonotic%2Fxonotic-data.pk3dir.git Make work better some lists --- diff --git a/qcsrc/menu/xonotic/languagelist.qc b/qcsrc/menu/xonotic/languagelist.qc index af9d75211..4ff177556 100644 --- a/qcsrc/menu/xonotic/languagelist.qc +++ b/qcsrc/menu/xonotic/languagelist.qc @@ -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; } } diff --git a/qcsrc/menu/xonotic/serverlist.qc b/qcsrc/menu/xonotic/serverlist.qc index 8bf70cc33..f2b01c6fb 100644 --- a/qcsrc/menu/xonotic/serverlist.qc +++ b/qcsrc/menu/xonotic/serverlist.qc @@ -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)); diff --git a/qcsrc/menu/xonotic/skinlist.qc b/qcsrc/menu/xonotic/skinlist.qc index 7400b379f..d505a2894 100644 --- a/qcsrc/menu/xonotic/skinlist.qc +++ b/qcsrc/menu/xonotic/skinlist.qc @@ -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; } } diff --git a/qcsrc/menu/xonotic/weaponslist.qc b/qcsrc/menu/xonotic/weaponslist.qc index adc7fc211..f4bcf4fea 100644 --- a/qcsrc/menu/xonotic/weaponslist.qc +++ b/qcsrc/menu/xonotic/weaponslist.qc @@ -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)