Opened 23 months ago
Closed 23 months ago
#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 )
- Related forum thread: Alpha 26 Pre-release/Release Candidate Build Testing (9/Jun/22)
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 | */ |
131 | function 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 | */ |
146 | function 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 | |
---|---|
223 | function 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
related patch
A similar problem was recently fixed for tooltips
- Phab:D4332 - Ceil the resource costs for insufficient resources. (23/Jan/22)
Attachments (1)
Change History (2)
by , 23 months ago
Attachment: | deci_sum.jpg added |
---|
comment:1 by , 23 months ago
Description: | modified (diff) |
---|---|
Milestone: | Alpha 26 |
Resolution: | → duplicate |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I knew there was a ticket for this. #4099