From: Samual Lenks Date: Sat, 12 Oct 2013 22:54:31 +0000 (-0400) Subject: Support promoted servers in the recommendations X-Git-Tag: xonotic-v0.8.0~256^2~10 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c04e0625843bcd3b58fe156c2c210f1755ad4568;p=xonotic%2Fxonotic-data.pk3dir.git Support promoted servers in the recommendations --- diff --git a/qcsrc/menu/xonotic/serverlist.c b/qcsrc/menu/xonotic/serverlist.c index 8d09155ac..795e68a4b 100644 --- a/qcsrc/menu/xonotic/serverlist.c +++ b/qcsrc/menu/xonotic/serverlist.c @@ -111,6 +111,7 @@ 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) float CheckCategoryOverride(float cat); @@ -308,42 +309,50 @@ float CheckCategoryForEntry(float entry) // now check if it's recommended if(autocvar_menu_slist_recommendations) { - float recommended = 0; - if(autocvar_menu_slist_recommendations & 1) - { - if(IsRecommended(gethostcachestring(SLIST_FIELD_CNAME, entry))) - { ++recommended; } - else - { --recommended; } - } - if(autocvar_menu_slist_recommendations & 2) + string cname = gethostcachestring(SLIST_FIELD_CNAME, entry); + + if(IsPromoted(cname)) { return CAT_RECOMMENDED; } + else { - if( - (freeslots >= autocvar_menu_slist_recommendations_minfreeslots) - && - ( - (autocvar_menu_slist_recommendations_purethreshold < 0) - || - (impure <= autocvar_menu_slist_recommendations_purethreshold) - ) - && - ( - gethostcachenumber(SLIST_FIELD_NUMHUMANS, entry) - >= - autocvar_menu_slist_recommendations_minhumans - ) - && - ( - gethostcachenumber(SLIST_FIELD_PING, entry) - <= - autocvar_menu_slist_recommendations_maxping + float recommended = 0; + if(autocvar_menu_slist_recommendations & 1) + { + if(IsRecommended(cname)) { ++recommended; } + else { --recommended; } + } + if(autocvar_menu_slist_recommendations & 2) + { + if( + ///// check for minimum free slots + (freeslots >= autocvar_menu_slist_recommendations_minfreeslots) + + && // check for purity requirement + ( + (autocvar_menu_slist_recommendations_purethreshold < 0) + || + (impure <= autocvar_menu_slist_recommendations_purethreshold) + ) + + && // check for minimum amount of humans + ( + gethostcachenumber(SLIST_FIELD_NUMHUMANS, entry) + >= + autocvar_menu_slist_recommendations_minhumans + ) + + && // check for maximum latency + ( + gethostcachenumber(SLIST_FIELD_PING, entry) + <= + autocvar_menu_slist_recommendations_maxping + ) ) - ) - { ++recommended; } - else - { --recommended; } + { ++recommended; } + else + { --recommended; } + } + if(recommended > 0) { return CAT_RECOMMENDED; } } - if(recommended > 0) { return CAT_RECOMMENDED; } } // if not favorited or recommended, check modname @@ -575,6 +584,13 @@ void XonoticServerList_draw(entity me) _Nex_ExtResponseSystem_BannedServersNeedsRefresh = 0; } + if(_Nex_ExtResponseSystem_PromotedServersNeedsRefresh) + { + if(!me.needsRefresh) + me.needsRefresh = 3; + _Nex_ExtResponseSystem_PromotedServersNeedsRefresh = 0; + } + if(_Nex_ExtResponseSystem_RecommendedServersNeedsRefresh) { if(!me.needsRefresh)