Page MenuHomeWildfire Games

Rename CClientArea to CGUISize, GUIBase to CGUISize and avoid some temporary CGUISize instances
ClosedPublic

Authored by elexis on Oct 1 2019, 4:42 PM.

Details

Summary

Enabled by rP23022/D2340, the GUIbase.h file can be renamed accordingly with GUIbase.cpp to CGUISize.cpp.
See summary at D2340 for the reasoning and the reference to the few words on IRC with Vladislav.
The reason to rename the class CGUISize is because it does contain a size specified in GUI syntax, because it is the type of the "size" properties and some size members.

While at it, we can avoid the duplicate 0 0 100 100 constructor with a static getter,
and avoid temporary instances that are copied on success.

Test Plan

Notice that the FromString function already has its own temporaries that are reported on and discarded upon failure and copied upon success, and states that in the header comment.
So the copies in CGUI.cpp are unnecessary.
Notice that SGUIIcon is only constructed in four places (all four with new), and those are always assigning the 0 0 100 100 default value.
Hence we can construct them already with that value and avoid code duplication and copy assignments.

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

elexis created this revision.Oct 1 2019, 4:42 PM
Vulcan added a comment.Oct 1 2019, 4:43 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/885/display/redirect

Vulcan added a comment.Oct 1 2019, 4:46 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/369/display/redirect

elexis edited the test plan for this revision. (Show Details)Oct 1 2019, 4:55 PM
elexis added inline comments.Oct 1 2019, 5:02 PM
source/gui/CGUISize.h
81 ↗(On Diff #10033)

The error codes are to be removed in the next step, have a patch for that, but I will commit this cleanup patch prior, just to remove the stack of TODOs.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 1 2019, 5:06 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.