X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fdialog_multiplayer_join_serverinfo.c;h=d396e7bbcc747a449a2cd482c743ca5564b0d582;hb=60f1e3301beae3dac0765d8ee8eb350ee21c8f30;hp=3ae9f08381a81e2fc3d3bc7b33a416875d6ac4cc;hpb=fc3e13dd48a3e16c4173617475adc240ace548fe;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.c b/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.c index 3ae9f0838..d396e7bbc 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.c +++ b/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.c @@ -56,7 +56,7 @@ void Join_Click(entity btn, entity me); #ifdef IMPLEMENTATION void XonoticServerInfoDialog_loadServerInfo(entity me, float i) { - float m, pure, j, numh, maxp; + float m, pure, freeslots, j, numh, maxp, numb; string s, typestr, versionstr, k, v; if(me.currentServerName) @@ -123,6 +123,7 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i) typestr = argv(0); versionstr = argv(1); } + freeslots = -1; for(j = 2; j < m; ++j) { if(argv(j) == "") @@ -131,6 +132,8 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i) v = substring(argv(j), 1, -1); if(k == "P") pure = stof(v); + else if(k == "S") + freeslots = stof(v); } me.currentServerType = strzone(typestr); @@ -148,11 +151,14 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i) numh = gethostcachenumber(SLIST_FIELD_NUMHUMANS, i); SLIST_FIELD_MAXPLAYERS = gethostcacheindexforkey("maxplayers"); maxp = gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i); - me.currentServerNumPlayers = strzone(sprintf(_("%d/%d"), numh, maxp)); + SLIST_FIELD_NUMBOTS = gethostcacheindexforkey("numbots"); + numb = gethostcachenumber(SLIST_FIELD_NUMBOTS, i); + if(freeslots < 0) + freeslots = maxp - numh - numb; + me.currentServerNumPlayers = strzone(sprintf(_("%d/%d, %d free player slots"), numh, maxp, freeslots)); me.numPlayersLabel.setText(me.numPlayersLabel, me.currentServerNumPlayers); - SLIST_FIELD_NUMBOTS = gethostcacheindexforkey("numbots"); - s = ftos(gethostcachenumber(SLIST_FIELD_NUMBOTS, i)); + s = ftos(numb); me.currentServerNumBots = strzone(s); me.numBotsLabel.setText(me.numBotsLabel, me.currentServerNumBots);