Page MenuHomeWildfire Games

Warn if GUI object base and derived class call AddSetting for the same property
ClosedPublic

Authored by elexis on Sep 23 2019, 12:20 AM.

Details

Summary

Following rP22958 (related but not dependent cleanup in rP22952, rP22969) and this Dropdown diff, we can show a warning if a C++ author calls AddSetting on the same property more than once instead of silently ignoring that.
If there is code (especially C++ code), the reader thinks the code is purposeful, but in these cases its misleading as the setting was registered already.
If the derived class calls AddSetting it implies that the derived class has the freedom to chose the type T, when it hasn't, hence misleading.
The AddSetting call should be in the class that has all the GetSetting calls to it.

So this LOGERROR will help structure (keep structured) the codebase so that AddSetting and GetSetting calls will be in the same class, thus allowing to make those setting values members,
so that the class using them will be able to access them more quickly, as laid out by Vladislav in http://irclogs.wildfiregames.com/2019-09/2019-09-20-QuakeNet-%230ad-dev.log
Refs D2313

Test Plan

That all current GUI object types don't run into this LOGERROR any further can be tested by running a game, opening options page, summary screen, savegame screen.

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.Sep 23 2019, 12:20 AM

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

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

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

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

elexis edited the summary of this revision. (Show Details)Sep 23 2019, 12:43 AM
This revision was not accepted when it landed; it landed in state Needs Review.Sep 23 2019, 12:49 AM
This revision was automatically updated to reflect the committed changes.