From: terencehill Date: Sun, 21 Nov 2021 22:16:42 +0000 (+0100) Subject: Small serverlist's code cleanup X-Git-Tag: xonotic-v0.8.5~287 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=14852cf9bd240d149cabda7a7aba81438ec4e7c6;p=xonotic%2Fxonotic-data.pk3dir.git Small serverlist's code cleanup --- diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join.qc b/qcsrc/menu/xonotic/dialog_multiplayer_join.qc index a65a4945b..01e4381e8 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_join.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_join.qc @@ -18,8 +18,7 @@ entity makeXonoticServerListTab() void XonoticServerListTab_refresh(entity this, entity slist) { - bool clear = false; - slist.refreshServerList(slist, clear ? REFRESHSERVERLIST_RESET : REFRESHSERVERLIST_ASK); + slist.refreshServerList(slist, REFRESHSERVERLIST_ASK); } void XonoticServerListTab_fill(entity me) diff --git a/qcsrc/menu/xonotic/serverlist.qc b/qcsrc/menu/xonotic/serverlist.qc index 71119adf1..c990c9212 100644 --- a/qcsrc/menu/xonotic/serverlist.qc +++ b/qcsrc/menu/xonotic/serverlist.qc @@ -6,6 +6,12 @@ #include "dialog_multiplayer_join_serverinfo.qh" #include +#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 m_gethostcachecategory(float entry) { return CategoryOverride(CategoryForEntry(entry)); } + void SL_ProcessCategoryOverrides(.string override_field_string, .float override_field) { for (int i = 0; i < category_ent_count; ++i) @@ -1107,8 +1113,8 @@ bool XonoticServerList_keyDown(entity me, int scan, bool ascii, bool shift) { if(me.nItems != 0) { - float thisPos = me.getItemStart(me, me.selectedItem); - float thisHeight = me.getItemHeight(me, me.selectedItem); + float thisPos = me.getItemStart(me, me.selectedItem); + float thisHeight = me.getItemHeight(me, me.selectedItem); vector org = boxToGlobal(eY * (thisPos - me.scrollPos), me.origin, me.size); vector sz = boxToGlobalSize(eY * thisHeight + eX * (1 - me.controlWidth), me.size); m_play_click_sound(MENU_SOUND_OPEN); diff --git a/qcsrc/menu/xonotic/serverlist.qh b/qcsrc/menu/xonotic/serverlist.qh index db7404598..150e22071 100644 --- a/qcsrc/menu/xonotic/serverlist.qh +++ b/qcsrc/menu/xonotic/serverlist.qh @@ -125,14 +125,11 @@ const float REFRESHSERVERLIST_RESET = 3; // ..., also clear the list first // function declarations 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) entity RetrieveCategoryEnt(float catnum); float CategoryOverride(float cat); -float m_gethostcachecategory(float entry) { return CategoryOverride(CategoryForEntry(entry)); } +float m_gethostcachecategory(float entry); // fields for category entities