Ticket #2547: 2547.patch

File 2547.patch, 1.9 KB (added by Adrián Chaves, 9 years ago)

Solution based on existing code.

  • binaries/data/mods/public/gui/lobby/lobby.js

    diff --git a/binaries/data/mods/public/gui/lobby/lobby.js b/binaries/data/mods/public/gui/lobby/lobby.js
    index 1fcd183..eda00ae 100644
    a b function updateGameList()  
    399399            list_name.push(name);
    400400            list_ip.push(g.ip);
    401401            list_mapName.push(translate(g.niceMapName));
    402             if (+g.mapSize !== +g.mapSize) // NaN
    403                 list_mapSize.push(translate(g.mapSize));
    404             else
    405                 list_mapSize.push(g_mapSizes.shortNames[g_mapSizes.tiles.indexOf(+g.mapSize)]);
     402            list_mapSize.push(translatedMapSize(g_GameList[g].mapSize));
    406403            let idx = g_mapTypes.indexOf(g.mapType);
    407404            list_mapType.push(idx != -1 ? g_mapTypesText[idx] : "");
    408405            list_nPlayers.push(g.nbp + "/" +g.tnbp);
    function formatPlayerListEntry(nickname, presence, rating)  
    480477}
    481478
    482479/**
     480 * Given a map size, returns that map size translated into the current
     481 * language.
     482 */
     483function translatedMapSize(mapSize)
     484{
     485    if (+mapSize !== +mapSize) // NaN
     486        return translate(mapSize);
     487    else
     488        return g_mapSizes.shortNames[g_mapSizes.tiles.indexOf(+mapSize)];
     489}
     490
     491/**
    483492 * Populate the game info area with information on the current game selection.
    484493 */
    485494function updateGameSelection()
    function updateGameSelection()  
    517526    Engine.GetGUIObjectByName("sgMapName").caption = translate(g_GameList[g].niceMapName);
    518527    Engine.GetGUIObjectByName("sgNbPlayers").caption = g_GameList[g].nbp + "/" + g_GameList[g].tnbp;
    519528    Engine.GetGUIObjectByName("sgPlayersNames").caption = g_GameList[g].players;
    520     Engine.GetGUIObjectByName("sgMapSize").caption = g_GameList[g].mapSize.split("(")[0];
     529    Engine.GetGUIObjectByName("sgMapSize").caption = translatedMapSize(g_GameList[g].mapSize);
    521530    let idx = g_mapTypes.indexOf(g_GameList[g].mapType);
    522531    Engine.GetGUIObjectByName("sgMapType").caption = idx != -1 ? g_mapTypesText[idx] : "";
    523532