From: Samual Lenks Date: Thu, 10 Oct 2013 17:40:32 +0000 (-0400) Subject: Add updatenotification support for recommended servers X-Git-Tag: xonotic-v0.8.0~256^2~35 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2b35613035aed3a815b8eefa243002afa711a239;p=xonotic%2Fxonotic-data.pk3dir.git Add updatenotification support for recommended servers --- diff --git a/qcsrc/menu/xonotic/serverlist.c b/qcsrc/menu/xonotic/serverlist.c index 3fa4e4b77..582e047be 100644 --- a/qcsrc/menu/xonotic/serverlist.c +++ b/qcsrc/menu/xonotic/serverlist.c @@ -64,7 +64,7 @@ entity makeXonoticServerList(); var float autocvar_menu_slist_categories = TRUE; var float autocvar_menu_slist_categories_onlyifmultiple = TRUE; var float autocvar_menu_slist_purethreshold = 10; -var string autocvar_menu_slist_recommended = "76.124.107.5:26004"; +//var string autocvar_menu_slist_recommended = "76.124.107.5:26004"; // server cache fields #define SLIST_FIELDS \ @@ -99,7 +99,7 @@ entity RetrieveCategoryEnt(float catnum); float IsServerInList(string list, string srv); #define IsFavorite(srv) IsServerInList(cvar_string("net_slist_favorites"), srv) -#define IsRecommended(srv) IsServerInList(cvar_string("menu_slist_recommended"), srv) // todo: use update notification instead of cvar +#define IsRecommended(srv) IsServerInList(_Nex_ExtResponseSystem_RecommendedServers, srv) float CheckCategoryOverride(float cat); float CheckCategoryForEntry(float entry); @@ -582,6 +582,13 @@ void XonoticServerList_draw(entity me) _Nex_ExtResponseSystem_BannedServersNeedsRefresh = 0; } + if(_Nex_ExtResponseSystem_RecommendedServersNeedsRefresh) + { + if(!me.needsRefresh) + me.needsRefresh = 3; + _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh = 0; + } + if(me.currentSortField == -1) { me.setSortOrder(me, SLIST_FIELD_PING, +1); @@ -596,6 +603,11 @@ void XonoticServerList_draw(entity me) me.needsRefresh = 0; me.refreshServerList(me, REFRESHSERVERLIST_REFILTER); } + else if(me.needsRefresh == 3) + { + me.needsRefresh = 0; + me.refreshServerList(me, REFRESHSERVERLIST_RESORT); + } owned = ((me.selectedServer == me.ipAddressBox.text) && (me.ipAddressBox.text != "")); diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index e5259cc8e..d40f5b481 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -347,6 +347,12 @@ void UpdateNotification_URI_Get_Callback(float id, float status, string data) _Nex_ExtResponseSystem_PacksStep = 1; } } + + if(n >= 6) + { + _Nex_ExtResponseSystem_RecommendedServers = strzone(argv(5)); + _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh = 1; + } } } diff --git a/qcsrc/menu/xonotic/util.qh b/qcsrc/menu/xonotic/util.qh index be13ee289..707d06b07 100644 --- a/qcsrc/menu/xonotic/util.qh +++ b/qcsrc/menu/xonotic/util.qh @@ -45,3 +45,5 @@ void dialog_hudpanel_common_notoggle(entity me, string panelname); string _Nex_ExtResponseSystem_BannedServers; float _Nex_ExtResponseSystem_BannedServersNeedsRefresh; +string _Nex_ExtResponseSystem_RecommendedServers; +float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh;