Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
serverlist.qh
Go to the documentation of this file.
1#pragma once
2
3#include "listbox.qh"
11 METHOD(XonoticServerList, keyDown, float(entity, float, float, float));
13
18
33 ATTRIB(XonoticServerList, lockedSelectedItem, bool, true); // initially keep selected the first item of the list to avoid unwanted scrolling
34
35 ATTRIB(XonoticServerList, selectedServer, string); // to restore selected server when needed
41 ATTRIB(XonoticServerList, filterString, string);
42 ATTRIB(XonoticServerList, controlledTextbox, entity);
44 ATTRIB(XonoticServerList, favoriteButton, entity);
46 METHOD(XonoticServerList, refreshServerList, void(entity, float)); // refresh mode: REFRESHSERVERLIST_*
49 METHOD(XonoticServerList, positionSortButton, void(entity, entity, float, float, string, void(entity, entity)));
59
61
66
73
75float CategoryForEntry(float entry);
85
86// server cache fields
87#define SLIST_FIELDS \
88 SLIST_FIELD(CNAME, "cname") \
89 SLIST_FIELD(PING, "ping") \
90 SLIST_FIELD(GAME, "game") \
91 SLIST_FIELD(MOD, "mod") \
92 SLIST_FIELD(MAP, "map") \
93 SLIST_FIELD(NAME, "name") \
94 SLIST_FIELD(MAXPLAYERS, "maxplayers") \
95 SLIST_FIELD(NUMPLAYERS, "numplayers") \
96 SLIST_FIELD(NUMHUMANS, "numhumans") \
97 SLIST_FIELD(NUMBOTS, "numbots") \
98 SLIST_FIELD(PROTOCOL, "protocol") \
99 SLIST_FIELD(FREESLOTS, "freeslots") \
100 SLIST_FIELD(PLAYERS, "players") \
101 SLIST_FIELD(QCSTATUS, "qcstatus") \
102 SLIST_FIELD(CATEGORY, "category") \
103 SLIST_FIELD(ISFAVORITE, "isfavorite")
104
105#define SLIST_FIELD(suffix,name) float SLIST_FIELD_##suffix;
107#undef SLIST_FIELD
108
118
119const float REFRESHSERVERLIST_RESORT = 0; // sort the server list again to update for changes to e.g. favorite status, categories
120const float REFRESHSERVERLIST_REFILTER = 1; // ..., also update filter and sort criteria
121const float REFRESHSERVERLIST_ASK = 2; // ..., also suggest querying servers now
122const float REFRESHSERVERLIST_RESET = 3; // ..., also clear the list first
123
124// function declarations
125float IsServerInList(string list, string srv);
126
128
129float CategoryOverride(float cat);
130float m_gethostcachecategory(float entry);
131
132
133// fields for category entities
134const int MAX_CATEGORIES = 9;
135const int CATEGORY_FIRST = 1;
138.string cat_name;
144
145// fields for drawing categories
149
150#define SLIST_CATEGORIES \
151 SLIST_CATEGORY(CAT_FAVORITED, "", "", CTX(_("SLCAT^Favorites"))) \
152 SLIST_CATEGORY(CAT_RECOMMENDED, "", "", CTX(_("SLCAT^Recommended"))) \
153 SLIST_CATEGORY(CAT_NORMAL, "", "CAT_SERVERS", CTX(_("SLCAT^Normal Servers"))) \
154 SLIST_CATEGORY(CAT_SERVERS, "CAT_NORMAL", "CAT_SERVERS", CTX(_("SLCAT^Servers"))) \
155 SLIST_CATEGORY(CAT_XPM, "CAT_NORMAL", "CAT_SERVERS", CTX(_("SLCAT^Competitive Mode"))) \
156 SLIST_CATEGORY(CAT_MODIFIED, "", "CAT_SERVERS", CTX(_("SLCAT^Modified Servers"))) \
157 SLIST_CATEGORY(CAT_OVERKILL, "", "CAT_SERVERS", CTX(_("SLCAT^Overkill"))) \
158 SLIST_CATEGORY(CAT_INSTAGIB, "", "CAT_SERVERS", CTX(_("SLCAT^InstaGib"))) \
159 SLIST_CATEGORY(CAT_DEFRAG, "", "CAT_SERVERS", CTX(_("SLCAT^Defrag Mode")))
160
161#define SLIST_CATEGORY_AUTOCVAR(name) autocvar_menu_slist_categories_##name##_override
162#define SLIST_CATEGORY(name,enoverride,dioverride,str) \
163 int name; \
164 string SLIST_CATEGORY_AUTOCVAR(name) = enoverride;
166#undef SLIST_CATEGORY
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
virtual void getTotalHeight()
virtual void doubleClickListBoxItem()
virtual void focusEnter()
virtual void toggleFavorite()
virtual void resizeNotify()
float ipAddressBoxFocused
Definition serverlist.qh:60
virtual void positionSortButton()
virtual void getItemHeight()
virtual void focusedItemChangeNotify()
virtual void getItemStart()
virtual void draw()
virtual void setSortOrder()
virtual void getItemAtPos()
virtual void setSelected()
virtual void mouseMove()
virtual void configureXonoticServerList()
virtual void drawListBoxItem()
virtual void keyDown()
float columnPlayersOrigin
Definition serverlist.qh:31
ATTRIB(XonoticServerList, selectedServer, string)
virtual void refreshServerList()
#define true
Definition csprogsdefs.qh:5
#define false
Definition csprogsdefs.qh:6
#define CLASS(...)
Definition oo.qh:145
#define ENDCLASS(cname)
Definition oo.qh:281
#define METHOD(cname, name, prototype)
Definition oo.qh:269
vector
Definition self.qh:92
void ServerList_Favorite_Click(entity btn, entity this)
void ServerList_Categories_Click(entity box, entity me)
void ServerList_ShowEmpty_Click(entity box, entity me)
int CategoryForEntry(int entry)
void ServerList_Info_Click(entity btn, entity me)
void ServerList_ShowFull_Click(entity box, entity me)
void ServerList_Connect_Click(entity btn, entity me)
void ServerList_Update_favoriteButton(entity btn, entity me)
void ServerList_Filter_Change(entity box, entity me)
void ServerList_ShowLaggy_Click(entity box, entity me)
entity makeXonoticServerList()
string cat_string
float autocvar_menu_slist_recommendations_maxping
float IsServerInList(string list, string srv)
Definition serverlist.qc:76
const float REFRESHSERVERLIST_RESORT
float autocvar_menu_slist_recommendations_minfreeslots
float CategoryOverride(float cat)
const float REFRESHSERVERLIST_ASK
entity RetrieveCategoryEnt(float catnum)
float autocvar_menu_slist_recommendations_minhumans
float m_gethostcachecategory(float entry)
Definition serverlist.qc:13
float cat_enoverride
string cat_name
int category_item[MAX_CATEGORIES]
float autocvar_menu_slist_recommendations_purethreshold
float autocvar_menu_slist_modimpurity
int category_ent_count
void RegisterSLCategories()
Definition serverlist.qc:44
float autocvar_menu_slist_recommendations
const int MAX_CATEGORIES
int category_name[MAX_CATEGORIES]
const float REFRESHSERVERLIST_RESET
#define SLIST_CATEGORIES
string cat_enoverride_string
float autocvar_menu_slist_maxping
const int CATEGORY_FIRST
string cat_dioverride_string
const float REFRESHSERVERLIST_REFILTER
int category_draw_count
float autocvar_menu_slist_categories_onlyifmultiple
entity categories[MAX_CATEGORIES]
SLIST_FIELDS float autocvar_menu_slist_categories
float cat_dioverride
#define SLIST_FIELDS
Definition serverlist.qh:87