Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
dialog_multiplayer_join_serverinfo.qc File Reference
Include dependency graph for dialog_multiplayer_join_serverinfo.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void Join_Click (entity btn, entity me)
void XonoticServerInfoDialog_fill (entity me)
void XonoticServerInfoDialog_loadServerInfo (entity me, float i)

Function Documentation

◆ Join_Click()

void Join_Click ( entity btn,
entity me )

Definition at line 232 of file dialog_multiplayer_join_serverinfo.qc.

233{
234 localcmd("connect ", me.currentServerCName, "\n");
235}
void localcmd(string command,...)

References entity(), and localcmd().

Referenced by XonoticServerInfoDialog::ATTRIB(), and XonoticServerInfoDialog_fill().

◆ XonoticServerInfoDialog_fill()

void XonoticServerInfoDialog_fill ( entity me)

Definition at line 208 of file dialog_multiplayer_join_serverinfo.qc.

209{
210 entity mc, e;
211 mc = makeXonoticTabController(me.rows - 2);
212 me.TR(me);
213 me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Status"), me.infoTab = makeXonoticServerInfoTab()));
214 me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Terms of Service"), me.ToSTab = makeXonoticServerToSTab()));
215
216 me.TR(me);
217 me.TD(me, me.rows - 2, me.columns, mc);
218
219 me.gotoRC(me, me.rows - 1, 0);
220 me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Close"), '0 0 0'));
221 e.onClick = Dialog_Close;
222 e.onClickEntity = me;
223 //me.TD(me, 1, me.columns/3, e = makeXonoticButton("", '0 0 0')); // TODO: Add bookmark button here
224 // e.onClick = ServerList_Favorite_Click;
225 // e.onClickEntity = slist;
226 // slist.favoriteButton = e;
227 me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Join!"), '0 0 0'));
228 e.onClick = Join_Click;
229 e.onClickEntity = me;
230}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void Join_Click(entity btn, entity me)
void Dialog_Close(entity button, entity me)
Definition dialog.qc:7
entity makeXonoticButton(string theText, vector theColor)
Definition button.qc:10
entity makeXonoticTabController(float theRows)

References Dialog_Close(), entity(), Join_Click(), makeXonoticButton(), makeXonoticServerInfoTab(), makeXonoticServerToSTab(), and makeXonoticTabController().

◆ XonoticServerInfoDialog_loadServerInfo()

void XonoticServerInfoDialog_loadServerInfo ( entity me,
float i )

Definition at line 14 of file dialog_multiplayer_join_serverinfo.qc.

15{
16 bool pure_available;
17 float m, pure_violations, freeslots, numh, maxp, numb, sflags;
18 string s, typestr, versionstr, k, v, modname;
19
20 // ====================================
21 // First clear and unzone the strings
22 // ====================================
23 strfree(me.currentServerName);
24 strfree(me.currentServerCName);
25 strfree(me.currentServerType);
26 strfree(me.currentServerMap);
27 strfree(me.currentServerPlayers);
28 strfree(me.currentServerNumPlayers);
29 strfree(me.currentServerNumBots);
30 strfree(me.currentServerNumFreeSlots);
31 strfree(me.currentServerMod);
32 strfree(me.currentServerVersion);
33 // not zoned!
34 // strfree(me.currentServerEncrypt);
35 strfree(me.currentServerPure);
36 strfree(me.currentServerKey);
37 strfree(me.currentServerID);
38
39 // ==========================
40 // Now, fill in the strings
41 // ==========================
42 me.currentServerName = strzone(gethostcachestring(SLIST_FIELD_NAME, i));
43 me.infoTab.nameLabel.setText(me.infoTab.nameLabel, me.currentServerName);
44
45 me.currentServerCName = strzone(gethostcachestring(SLIST_FIELD_CNAME, i));
46 me.infoTab.cnameLabel.setText(me.infoTab.cnameLabel, me.currentServerCName);
47
48 pure_available = false;
49 pure_violations = -1;
50 typestr = _("N/A");
51 versionstr = _("N/A");
52
53 s = gethostcachestring(SLIST_FIELD_QCSTATUS, i);
54 m = tokenizebyseparator(s, ":");
55 if(m >= 2)
56 {
57 typestr = argv(0);
58 versionstr = argv(1);
59 }
60 freeslots = -1;
61 sflags = -1;
62 modname = "";
63 bool ToSSpecified = false;
64 for(int j = 2; j < m; ++j)
65 {
66 if(argv(j) == "")
67 break;
68 k = substring(argv(j), 0, 1);
69 v = substring(argv(j), 1, -1);
70 if(k == "P")
71 {
72 pure_available = true;
73 pure_violations = stof(v);
74 }
75 else if(k == "S")
76 {
77 freeslots = stof(v);
78 }
79 else if(k == "F")
80 {
81 sflags = stof(v);
82 }
83 else if(k == "M")
84 {
85 modname = v;
86 }
87 else if(k == "T")
88 {
89 ToSSpecified = true;
90 string downloadurl = v;
91 if (downloadurl == "INVALID")
92 {
93 me.ToSTab.textBox.setText(me.ToSTab.textBox, _("No Terms of Service specified"));
94 }
95 else
96 {
97 downloadurl = strreplace("|", ":", downloadurl);
98 me.ToSTab.loadToS(me.ToSTab, downloadurl);
99 }
100 }
101 }
102
103 if (!ToSSpecified)
104 {
105 me.ToSTab.textBox.setText(me.ToSTab.textBox, _("No Terms of Service specified"));
106 }
107
108#ifdef COMPAT_NO_MOD_IS_XONOTIC
109 if(modname == "")
110 modname = "Xonotic";
111#endif
112
113 s = gethostcachestring(SLIST_FIELD_MOD, i);
114 if(s != "data")
115 modname = sprintf("%s (%s)", modname, s);
116
117 Gametype j = MapInfo_Type_FromString(typestr, false, false); // try and get the real name of the gametype
118 if(j) { typestr = MapInfo_Type_ToText(j); } // only set it if we actually found it
119
120 me.currentServerType = strzone(typestr);
121 me.infoTab.typeLabel.setText(me.infoTab.typeLabel, me.currentServerType);
122
123 me.currentServerMap = strzone(gethostcachestring(SLIST_FIELD_MAP, i));
124 me.infoTab.mapLabel.setText(me.infoTab.mapLabel, me.currentServerMap);
125
126 me.currentServerPlayers = strzone(gethostcachestring(SLIST_FIELD_PLAYERS, i));
127 me.infoTab.rawPlayerList.setPlayerList(me.infoTab.rawPlayerList, me.currentServerPlayers);
128
129 numh = gethostcachenumber(SLIST_FIELD_NUMHUMANS, i);
130 maxp = gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i);
131 numb = gethostcachenumber(SLIST_FIELD_NUMBOTS, i);
132 me.currentServerNumPlayers = strzone(sprintf("%d/%d", numh, maxp));
133 me.infoTab.numPlayersLabel.setText(me.infoTab.numPlayersLabel, me.currentServerNumPlayers);
134
135 s = ftos(numb);
136 me.currentServerNumBots = strzone(s);
137 me.infoTab.numBotsLabel.setText(me.infoTab.numBotsLabel, me.currentServerNumBots);
138
139 if(freeslots < 0) { freeslots = maxp - numh - numb; }
140 s = ftos(freeslots);
141 me.currentServerNumFreeSlots = strzone(s);
142 me.infoTab.numFreeSlotsLabel.setText(me.infoTab.numFreeSlotsLabel, me.currentServerNumFreeSlots);
143
144 me.currentServerMod = ((modname == "Xonotic") ? ZCTX(_("MOD^Default")) : modname);
145 me.currentServerMod = strzone(me.currentServerMod);
146 me.infoTab.modLabel.setText(me.infoTab.modLabel, me.currentServerMod);
147
148 me.currentServerVersion = strzone(versionstr);
149 me.infoTab.versionLabel.setText(me.infoTab.versionLabel, me.currentServerVersion);
150
151 me.currentServerPure = ((!pure_available) ? _("N/A") : (pure_violations == 0) ? _("Official") : sprintf(_("%d modified"), pure_violations));
152 me.currentServerPure = strzone(me.currentServerPure);
153 me.infoTab.pureLabel.setText(me.infoTab.pureLabel, me.currentServerPure);
154
155 s = crypto_getencryptlevel(me.currentServerCName);
156 if(s == "")
157 {
158 if(cvar("crypto_aeslevel") >= 3)
159 me.currentServerEncrypt = _("N/A (auth library missing, can't connect)");
160 else
161 me.currentServerEncrypt = _("N/A (auth library missing)");
162 }
163 else switch(stof(substring(s, 0, 1)))
164 {
165 case 0:
166 if(cvar("crypto_aeslevel") >= 3)
167 me.currentServerEncrypt = _("Not supported (can't connect)");
168 else
169 me.currentServerEncrypt = _("Not supported (won't encrypt)");
170 break;
171 case 1:
172 if(cvar("crypto_aeslevel") >= 2)
173 me.currentServerEncrypt = _("Supported (will encrypt)");
174 else
175 me.currentServerEncrypt = _("Supported (won't encrypt)");
176 break;
177 case 2:
178 if(cvar("crypto_aeslevel") >= 1)
179 me.currentServerEncrypt = _("Requested (will encrypt)");
180 else
181 me.currentServerEncrypt = _("Requested (won't encrypt)");
182 break;
183 case 3:
184 if(cvar("crypto_aeslevel") <= 0)
185 me.currentServerEncrypt = _("Required (can't connect)");
186 else
187 me.currentServerEncrypt = _("Required (will encrypt)");
188 break;
189 }
190 me.infoTab.encryptLabel.setText(me.infoTab.encryptLabel, me.currentServerEncrypt);
191 setZonedTooltip(me.infoTab.encryptLabel, _("Use the `crypto_aeslevel` cvar to change your preferences"), string_null);
192
193 s = crypto_getidfp(me.currentServerCName);
194 if (!s) { s = _("N/A"); }
195 me.currentServerID = strzone(s);
196 me.infoTab.idLabel.setText(me.infoTab.idLabel, me.currentServerID);
197
198 s = crypto_getkeyfp(me.currentServerCName);
199 if (!s) { s = _("N/A"); }
200 me.currentServerKey = strzone(s);
201 me.infoTab.keyLabel.setText(me.infoTab.keyLabel, me.currentServerKey);
202
203 me.currentServerStatsStatus = ((sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS)) ? ((sflags & SERVERFLAG_PLAYERSTATS_CUSTOM) ? _("custom stats server") : _("stats enabled")) : _("stats disabled"));
204 me.currentServerStatsStatus = strzone(me.currentServerStatsStatus);
205 me.infoTab.statsLabel.setText(me.infoTab.statsLabel, me.currentServerStatsStatus);
206}
const int SERVERFLAG_PLAYERSTATS
Definition constants.qh:18
const int SERVERFLAG_PLAYERSTATS_CUSTOM
Definition constants.qh:19
#define tokenizebyseparator
#define ZCTX(s)
Definition i18n.qh:68
string MapInfo_Type_ToText(Gametype t)
Definition mapinfo.qc:661
Gametype MapInfo_Type_FromString(string gtype, bool dowarn, bool is_q3compat)
Definition mapinfo.qc:621
void setZonedTooltip(entity e, string theTooltip, string theCvar)
Definition util.qc:257
float stof(string val,...)
string substring(string s, float start, float length)
float cvar(string name)
string gethostcachestring(float type, float hostnr)
float gethostcachenumber(float fld, float hostnr)
string ftos(float f)
string strzone(string s)
string argv(float n)
string string_null
Definition nil.qh:9
#define strfree(this)
Definition string.qh:59
string modname
Definition world.qh:49

References argv(), cvar(), entity(), ftos(), gethostcachenumber(), gethostcachestring(), MapInfo_Type_FromString(), MapInfo_Type_ToText(), modname, SERVERFLAG_PLAYERSTATS, SERVERFLAG_PLAYERSTATS_CUSTOM, setZonedTooltip(), stof(), strfree, string_null, strzone(), substring(), tokenizebyseparator, and ZCTX.