Ticket #3518: ticket3518_summarystyle_3.1.diff

File ticket3518_summarystyle_3.1.diff, 1.7 KB (added by bb, 8 years ago)

splitted from last patch: 2* foreach deprecated

  • binaries/data/mods/public/gui/summary/counters.js

     
    1818function calculateEconomyScore(playerState, position)
    1919{
    2020    let total = 0;
    21     for each (let res in playerState.statistics.resourcesGathered)
    22         total += res;
     21    for (let type in playerState.statistics.resourcesGathered)
     22        total += playerState.statistics.resourcesGathered[type];
    2323
    2424    return Math.round(total / 10);
    2525}
     
    202202function calculateBatteryEfficiency(playerState, position)
    203203{
    204204    let totalBought = 0;
    205     for each (let boughtAmount in playerState.statistics.resourcesBought)
    206         totalBought += boughtAmount;
    207205    let totalSold = 0;
    208     for each (let soldAmount in playerState.statistics.resourcesSold)
    209         totalSold += soldAmount;
     206    for (let boughtAmount in playerState.statistics.resourcesBought)
     207        totalBought += playerState.statistics.resourcesBought[boughtAmount];
     208    for (let soldAmount in playerState.statistics.resourcesSold)
     209        totalSold += playerState.statistics.resourcesSold[soldAmount];
    210210
    211211    return Math.floor(totalSold > 0 ? (totalBought / totalSold) * 100 : 0) + "%";
    212212}
     
    366366                else if (!g_TeamMiscHelperData[t][w].unitsLost) // and enemyUnitsKilled.total > 0
    367367                    teamTotal = g_InfiniteSymbol; // infinity symbol
    368368                else
    369                     teamTotal = Math.round((g_TeamMiscHelperData[t][w].enemyUnitsKilled / g_TeamMiscHelperData[t][w].unitsLost)*100)/100;
     369                    teamTotal = Math.round((g_TeamMiscHelperData[t][w].enemyUnitsKilled / g_TeamMiscHelperData[t][w].unitsLost) * 100) / 100;
    370370            }
    371371            else if (w >= 3)
    372372                teamTotal = g_TeamMiscHelperData[t][w] + "%";