Page MenuHomeWildfire Games

[CChart] Add a percentage format
ClosedPublic

Authored by Imarok on Sun, May 12, 1:34 AM.

Details

Summary

Adds a new format so that axis values can have a percentage sign.

Test Plan

Agree

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Imarok created this revision.Sun, May 12, 1:34 AM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/gui/CChart.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1373/display/redirect

Stan added a subscriber: Stan.Sun, May 12, 1:37 AM
Stan added inline comments.
source/gui/CChart.cpp
286 ↗(On Diff #7980)

Why 64 ? :)
Could it be contained in a smaller type like u8 ?

Imarok added inline comments.Sun, May 12, 1:38 AM
source/gui/CChart.cpp
286 ↗(On Diff #7980)

I just assumed vlad did a sane decision ;P

Imarok updated this revision to Diff 7981.Sun, May 12, 1:39 AM

Make the License Bear happy ;)

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/1374/display/redirect

bb accepted this revision.Mon, May 13, 9:00 PM
bb added a subscriber: bb.

looks like all summary percentages have a symbol now

This revision is now accepted and ready to land.Mon, May 13, 9:00 PM

The patch looks good for me.

source/gui/CChart.cpp
285 ↗(On Diff #7981)

As far as I remember it was 64 because float fits into it with enough space (it costs 40+ bytes with a maximum number) and it's aligned by 4, though it doesn't have any advantage in comparison with 48.

286 ↗(On Diff #7981)

Are you aware that static_cast<int>(99.999) is 99 and not 100?

Imarok updated this revision to Diff 8020.Mon, May 13, 11:01 PM

Rounding for INTEGER and PERCENTAGE. Seems saner to me.

This revision was landed with ongoing or failed builds.Mon, May 13, 11:23 PM
This revision was automatically updated to reflect the committed changes.

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/1401/display/redirect