#6561 closed enhancement (duplicate)

Avoid unnecessary decimal points for resource statistics in the Summary

Reported by: Langbart Owned by:
Priority: Should Have Milestone:
Component: UI & Simulation Keywords:
Cc: Patch:

Description (last modified by Langbart)

possible solution

Some values e.g. military or the economy score already receive a Math.round treatment (see summary/counters.js).

Line 
128/**
129 * Keep this in sync with the score computation in session/ for the lobby rating reports!
130 */
131function calculateEconomyScore(playerState, index)
132{
133 let total = 0;
134
135 // Notice that this skips the vegetarianFood property of resourcesGathered
136 for (let type of g_ResourceData.GetCodes())
137 total += playerState.sequences.resourcesGathered[type][index];
138
139 total += playerState.sequences.tradeIncome[index];
140 return Math.round(total / 10);
141}
142
143/**
144 * Keep this in sync with the score computation in session/ for the lobby rating reports!
145 */
146function calculateMilitaryScore(playerState, index)
147{
148 return Math.round((playerState.sequences.enemyUnitsKilledValue[index] +
149 playerState.sequences.unitsCapturedValue[index] +
150 playerState.sequences.enemyBuildingsDestroyedValue[index] +
151 playerState.sequences.buildingsCapturedValue[index]) / 10);
152}

Adding Math.round to more statistics seems like a quick&dirty solution.

Line 
223function calculateResources(playerState, index, type)
224{
225 return {
226 "count": playerState.sequences.resourcesCount[type][index],
227 "gathered": playerState.sequences.resourcesGathered[type][index],
228 "used": playerState.sequences.resourcesUsed[type][index] - playerState.sequences.resourcesSold[type][index]
229 };
230}

related ticket

Similar problem, but no mention of the decimal problem

  • #4097 - Not enough space for resources in summary screen (12/Jul/16)
  • #4099

related patch

A similar problem was recently fixed for tooltips

  • Phab:D4332 - Ceil the resource costs for insufficient resources. (23/Jan/22)

Attachments (1)

deci_sum.jpg (8.2 KB ) - added by Langbart 23 months ago.

Download all attachments as: .zip

Change History (2)

by Langbart, 23 months ago

Attachment: deci_sum.jpg added

comment:1 by Langbart, 23 months ago

Description: modified (diff)
Milestone: Alpha 26
Resolution: duplicate
Status: newclosed

I knew there was a ticket for this. #4099

Note: See TracTickets for help on using tickets.