ATTRIB(XonoticServerInfoDialog, pureLabel, entity, NULL)
ENDCLASS(XonoticServerInfoDialog)
-float SLIST_FIELD_NAME;
-float SLIST_FIELD_CNAME;
-float SLIST_FIELD_QCSTATUS;
-float SLIST_FIELD_MAP;
-float SLIST_FIELD_PLAYERS;
-float SLIST_FIELD_NUMHUMANS;
-float SLIST_FIELD_MAXPLAYERS;
-float SLIST_FIELD_NUMBOTS;
-float SLIST_FIELD_MOD;
void Join_Click(entity btn, entity me);
#endif
void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
{
float m, pure, freeslots, j, numh, maxp, numb, sflags;
- string s, typestr, versionstr, k, v;
+ string s, typestr, versionstr, k, v, modname;
// ====================================
// First clear and unzone the strings
if(me.currentServerName)
strunzone(me.currentServerName);
me.currentServerName = string_null;
-
+
if(me.currentServerCName)
strunzone(me.currentServerCName);
me.currentServerCName = string_null;
-
+
if(me.currentServerType)
strunzone(me.currentServerType);
me.currentServerType = string_null;
-
+
if(me.currentServerMap)
strunzone(me.currentServerMap);
me.currentServerMap = string_null;
-
+
if(me.currentServerPlayers)
strunzone(me.currentServerPlayers);
me.currentServerPlayers = string_null;
-
+
if(me.currentServerNumPlayers)
strunzone(me.currentServerNumPlayers);
me.currentServerNumPlayers = string_null;
-
+
if(me.currentServerNumBots)
strunzone(me.currentServerNumBots);
me.currentServerNumBots = string_null;
-
+
if(me.currentServerNumFreeSlots)
strunzone(me.currentServerNumFreeSlots);
me.currentServerNumFreeSlots = string_null;
-
+
if(me.currentServerMod)
strunzone(me.currentServerMod);
me.currentServerMod = string_null;
-
+
if(me.currentServerVersion)
strunzone(me.currentServerVersion);
me.currentServerVersion = string_null;
-
+
// not zoned!
//if(me.currentServerEncrypt)
// strunzone(me.currentServerEncrypt);
if(me.currentServerPure)
strunzone(me.currentServerPure);
me.currentServerPure = string_null;
-
+
if(me.currentServerKey)
strunzone(me.currentServerKey);
me.currentServerKey = string_null;
-
+
if(me.currentServerID)
strunzone(me.currentServerID);
me.currentServerID = string_null;
// ==========================
// Now, fill in the strings
// ==========================
- SLIST_FIELD_NAME = gethostcacheindexforkey("name");
me.currentServerName = strzone(gethostcachestring(SLIST_FIELD_NAME, i));
me.nameLabel.setText(me.nameLabel, me.currentServerName);
- SLIST_FIELD_CNAME = gethostcacheindexforkey("cname");
me.currentServerCName = strzone(gethostcachestring(SLIST_FIELD_CNAME, i));
me.cnameLabel.setText(me.cnameLabel, me.currentServerCName);
typestr = _("N/A");
versionstr = _("N/A");
- SLIST_FIELD_QCSTATUS = gethostcacheindexforkey("qcstatus");
s = gethostcachestring(SLIST_FIELD_QCSTATUS, i);
m = tokenizebyseparator(s, ":");
if(m >= 2)
}
freeslots = -1;
sflags = -1;
+ modname = "";
for(j = 2; j < m; ++j)
{
if(argv(j) == "")
freeslots = stof(v);
else if(k == "F")
sflags = stof(v);
+ else if(k == "M")
+ modname = v;
}
+#ifdef COMPAT_NO_MOD_IS_XONOTIC
+ if(modname == "")
+ modname = "Xonotic";
+#endif
+
+ s = gethostcachestring(SLIST_FIELD_MOD, i);
+ if(s != "data")
+ modname = sprintf(_("%s (%s)"), modname, s);
+
j = MapInfo_Type_FromString(typestr); // try and get the real name of the game type
if(j) { typestr = MapInfo_Type_ToText(j); } // only set it if we actually found it
-
+
me.currentServerType = strzone(typestr);
me.typeLabel.setText(me.typeLabel, me.currentServerType);
- SLIST_FIELD_MAP = gethostcacheindexforkey("map");
me.currentServerMap = strzone(gethostcachestring(SLIST_FIELD_MAP, i));
me.mapLabel.setText(me.mapLabel, me.currentServerMap);
- SLIST_FIELD_PLAYERS = gethostcacheindexforkey("players");
me.currentServerPlayers = strzone(gethostcachestring(SLIST_FIELD_PLAYERS, i));
me.rawPlayerList.setPlayerList(me.rawPlayerList, me.currentServerPlayers);
- SLIST_FIELD_NUMHUMANS = gethostcacheindexforkey("numhumans");
numh = gethostcachenumber(SLIST_FIELD_NUMHUMANS, i);
- SLIST_FIELD_MAXPLAYERS = gethostcacheindexforkey("maxplayers");
maxp = gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i);
- SLIST_FIELD_NUMBOTS = gethostcacheindexforkey("numbots");
numb = gethostcachenumber(SLIST_FIELD_NUMBOTS, i);
me.currentServerNumPlayers = strzone(sprintf(_("%d/%d"), numh, maxp));
me.numPlayersLabel.setText(me.numPlayersLabel, me.currentServerNumPlayers);
s = ftos(numb);
me.currentServerNumBots = strzone(s);
me.numBotsLabel.setText(me.numBotsLabel, me.currentServerNumBots);
-
+
if(freeslots < 0) { freeslots = maxp - numh - numb; }
s = ftos(freeslots);
me.currentServerNumFreeSlots = strzone(s);
me.numFreeSlotsLabel.setText(me.numFreeSlotsLabel, me.currentServerNumFreeSlots);
- SLIST_FIELD_MOD = gethostcacheindexforkey("mod");
- s = gethostcachestring(SLIST_FIELD_MOD, i);
- s = ((s == "data") ? _("Default") : s);
- me.currentServerMod = strzone(s);
+ me.currentServerMod = ((modname == "Xonotic") ? _("Default") : modname);
+ me.currentServerMod = strzone(me.currentServerMod);
me.modLabel.setText(me.modLabel, me.currentServerMod);
me.currentServerVersion = strzone(versionstr);
break;
}
me.encryptLabel.setText(me.encryptLabel, me.currentServerEncrypt);
-
+
s = crypto_getidfp(me.currentServerCName);
- if not(s) { s = _("N/A"); }
+ if (!s) { s = _("N/A"); }
me.currentServerID = strzone(s);
me.idLabel.setText(me.idLabel, me.currentServerID);
s = crypto_getkeyfp(me.currentServerCName);
- if not(s) { s = _("N/A"); }
+ if (!s) { s = _("N/A"); }
me.currentServerKey = strzone(s);
me.keyLabel.setText(me.keyLabel, me.currentServerKey);
}
e.colorL = SKINCOLOR_SERVERINFO_IP;
e.allowCut = 1;
me.cnameLabel = e;
-
+
me.TR(me);
me.TR(me);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Gametype:")));
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
e.allowCut = 1;
me.pureLabel = e;
-
+
me.TR(me);
me.TR(me);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Players:")));
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
e.allowCut = 1;
me.numFreeSlotsLabel = e;
-
+
me.gotoRC(me, me.rows - 5, 0);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Encryption:")));
me.TD(me, 1, 5.4, e = makeXonoticTextLabel(0, ""));