Index: binaries/data/mods/public/gui/lobby/lobby.js =================================================================== --- binaries/data/mods/public/gui/lobby/lobby.js +++ binaries/data/mods/public/gui/lobby/lobby.js @@ -80,6 +80,11 @@ */ var g_ChatCommandColor = "200 200 255"; +/** + * Color for the player count number in the games list. + */ +var g_ObserverCountTags = { "color": "gray" }; + /** * Indicates if the lobby is opened as a dialog or window. */ @@ -973,6 +978,7 @@ g_GameList = Engine.GetGameList().map(game => { game.hasBuddies = 0; + game.observerCount = 0; // Compute average rating of participating players let playerRatings = []; @@ -983,6 +989,8 @@ if (player.Team != "observer") playerRatings.push(playerNickRating.rating || g_DefaultLobbyRating); + else + ++game.observerCount; // Sort games with playing buddies above games with spectating buddies if (game.hasBuddies < 2 && g_Buddies.indexOf(playerNickRating.nick) != -1) @@ -1059,12 +1067,32 @@ if (game.ip == g_SelectedGameIP && game.port == g_SelectedGamePort) selectedGameIndex = +i; + let playerText; + if (game.observerCount) + { + // Translation: The number of non-bot players and observers in this game + playerText = setStringTags(sprintf(translate("%(current)s/%(max)s +%(observercount)s"), { + "current": game.nbp, + "max": game.maxnbp, + "observercount": game.observerCount + }), g_ObserverCountTags); + } + else + { + playerText = game.nbp + "/" + game.maxnbp; + // Translation: The number of non-bot players in this game + playerText = setStringTags(sprintf(translate("%(current)s/%(max)s"), { + "current": game.nbp, + "max": game.maxnbp + }), g_ObserverCountTags); + } + list_buddy.push(game.hasBuddies ? coloredText(g_BuddySymbol, g_GameColors[game.state]) : ""); list_name.push(coloredText(gameName, g_GameColors[game.state])); list_mapName.push(translateMapTitle(game.niceMapName)); list_mapSize.push(translateMapSize(game.mapSize)); list_mapType.push(g_MapTypes.Title[mapTypeIdx] || ""); - list_nPlayers.push(game.nbp + "/" + game.maxnbp); + list_nPlayers.push(playerText); list_gameRating.push(game.gameRating); list.push(gameName); list_data.push(i);