Page MenuHomeWildfire Games

Cleanup GUI includes, whitespace, map iterators, nullptr
ClosedPublic

Authored by elexis on Sep 23 2019, 1:03 AM.

Details

Summary

This diff

  • removes a bunch of unused includes in the GUI, adds some that are subsequently found missing elsewhere.
  • alphabetic include order
  • cpp files include their header first
  • Fix lots of terrible whitespace for members.
  • NULL -> nullptr
  • Avoid std::map count call, since find!=end will finish more quickly (after finding the first item, if there is one)
  • Remove an unused PSError
  • Remove a comment in IGUIObject about children being deleted recursively that should have been removed in rP22943 / D2311.
  • Remove some unneeded friend relationships
Test Plan

Grep for precompiled.h in 'source/gui/` to find that every cpp includes its h file first.
Read all includes and see which ones look unused, remove it, ask the compiler if its true.
Paste all includes into an alphabet sorter tool.
Grep for NULL.
Grep for count. Make sure to not mess up the equality condition.
Make sure that it compiles without precompiled headers as usual.

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, 1:03 AM
elexis added inline comments.Sep 23 2019, 1:04 AM
source/gui/CGUI.cpp
36 ↗(On Diff #9928)

These are the only ones I wont touch in this diff, this code should be restructured, so that adding a new GUI object type is possible without changing CGUI.cpp.

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

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

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

Linter detected issues:
Executing section Source...

source/gui/CGUIString.h
|  41| class·CGUIString
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCGUIString{' is invalid C code. Use --std or --language to configure the language.

source/gui/GUIRenderer.h
|  34| namespace·GUIRenderer
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'namespaceGUIRenderer{' is invalid C code. Use --std or --language to configure the language.

source/gui/CDropDown.h
|  44| class·CDropDown·:·public·CList
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCDropDown:' is invalid C code. Use --std or --language to configure the language.

source/gui/COList.h
|  35| »   CGUIColor·m_TextColor;
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCList:' is invalid C code. Use --std or --language to configure the language.

source/gui/CInput.h
|  33| class·CInput·:·public·IGUIScrollBarOwner
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCInput:' is invalid C code. Use --std or --language to configure the language.

source/gui/IGUITextOwner.h
|  45| class·IGUITextOwner·:·virtual·public·IGUIObject
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classIGUITextOwner:' is invalid C code. Use --std or --language to configure the language.

source/gui/CChart.h
|  36| »   std::vector<CVector2D>·m_Points;
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'std::vector' is invalid C code. Use --std or --language to configure the language.

source/gui/CGUI.h
|  53| »   std::map<CStr,·CStrW>·m_SettingsDefaults;
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'std::map' is invalid C code. Use --std or --language to configure the language.

source/gui/IGUIObject.h
|  43| class·IGUIObject
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classIGUIObject{' is invalid C code. Use --std or --language to configure the language.

source/gui/GUIbase.h
| 151| class·CClientArea
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCClientArea{' is invalid C code. Use --std or --language to configure the language.

source/gui/GUIManager.h
|  42| class·CGUIManager
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCGUIManager{' is invalid C code. Use --std or --language to configure the language.

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

source/gui/CGUIText.h
|  50| class·CGUIText
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCGUIText{' is invalid C code. Use --std or --language to configure the language.

source/gui/CGUISprite.h
|  93| »   std::shared_ptr<SGUIImageEffects>·m_Effects;
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'std::shared_ptr' 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/810/display/redirect

This revision was not accepted when it landed; it landed in state Needs Review.Sep 23 2019, 1:28 AM
This revision was automatically updated to reflect the committed changes.