Page MenuHomeWildfire Games

Unify 19 copies of IGUIObject::PlaySound and stop copying the according CStrW
ClosedPublic

Authored by elexis on Aug 21 2019, 11:19 PM.

Details

Summary

The code to play an UI sound on a GUI object depending on the configured value is copied 19 times (18 copies from rP13521, one from rP16781), when it's enough to specify the code once.
Also the CStrW was copied every call when a reference is just enough.

Test Plan

Notice that there is no code behavior change. Check that it compiles. Become an expert to still find a catch or make one up.

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.Aug 21 2019, 11:19 PM
wraitii added inline comments.
source/gui/IGUIObject.cpp
449 ↗(On Diff #9435)

This sounds vaguely like something that should be an error, but existing code didn't check so "?"

elexis added inline comments.Aug 21 2019, 11:26 PM
source/gui/IGUIObject.cpp
449 ↗(On Diff #9435)

I suppose it should be possible to specify a style that doesn't assign a sound to an event.

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

Linter detected issues:
Executing section Source...

source/gui/IGUIObject.h
|  44| template·<typename·T>·class·GUI;
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

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

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