Commit Graph

294 Commits

Author SHA1 Message Date
Lioncash 67f6666ea1 Runtime: Add more usages of explicit
Prevents error-prone implicit conversions where applicable.

This targets the regular RuntimeCommon target this time around.
2020-03-31 03:53:49 -04:00
Lioncash 6dce70895c CIOWin: Make Draw() non-const
Allows removing several const_cast usages within the codebase.
2020-03-29 21:56:49 -04:00
Lioncash 0d3bab4c14 CScanDisplay: Remove use of const_cast
The draw function is essentially not fully const in behavior, so we can
remove the const qualifiers where necessary.
2020-03-29 21:44:10 -04:00
Lioncash 2d8e94911a CGuiTextSupport: Eliminate the use of const_cast
We can supply a const and non-const variant to eliminate the need to
const_cast here.
2020-03-29 21:37:11 -04:00
Lioncash f3afcf7299 CGuiTextPane: Remove stray unnecessary const_cast in Draw()
Draw() isn't const qualified, so there's no need to cast away const
here.
2020-03-29 21:25:47 -04:00
Lioncash 603942daaf CTextRenderBuffer: Remove use of const_cast in Render()
Makes for much less casting.
2020-03-29 20:27:04 -04:00
Lioncash 04a42980ab Revert "Revert "CTextRenderBuffer: Forward declare structs where applicable""
This reverts commit 16745f3a7b.

We can simply default the move constructor and move assignment operator
to make this work.
2020-03-29 20:09:16 -04:00
Phillip Stephens 16745f3a7b
Revert "CTextRenderBuffer: Forward declare structs where applicable" 2020-03-29 16:35:02 -07:00
Phillip Stephens f3721844b9
Merge pull request #282 from lioncash/struct
CTextRenderBuffer: Forward declare structs where applicable
2020-03-29 16:04:32 -07:00
Lioncash 232ae12802 CGuiTextPane: Make use of std::array where applicable
Same behavior, but with stronger typing and allows removing of a
hardcoded array size.
2020-03-29 08:00:40 -04:00
Lioncash 0aff4dc21e CTextRenderBuffer: Remove use of const_cast within Render()
Same behavior but way less casting.
2020-03-29 04:42:58 -04:00
Lioncash 20b74c4818 CTextRenderBuffer: Forward declare structs where applicable
These are only used internally, so we can completely hide these structs
from external view.

This allows their implementation to be changed without needing to
recompile all the headers that include it.
2020-03-29 03:54:29 -04:00
Lioncash fda08db9b1 CHudVisorBeamMenu: Dehardcode array sizes
Same behavior, but queries the container for the size rather than
hardcoding it in loop bounds.
2020-03-29 03:08:41 -04:00
Lioncash 413483a996 CHudFreeLookInterfaceXRay: Assign free look and control held flags in SetFreeLookState()
GM8Ev0 does this.
2020-03-29 02:08:51 -04:00
Lioncash ad07b993c8 CHudFreeLookInterface: Collapse conditional within SetFreeLookState()
Same behavior, less code.
2020-03-29 02:03:20 -04:00
Lioncash 59fbefbd58 CGuiWidget: Provide names for all function prototypes
Makes parameter introspection nicer with IDEs and also renames ambiguous
"v" names to something more self-descriptive.
2020-03-29 01:52:23 -04:00
Lioncash 194cdf145f Runtime: Use nullptr where applicable
Same behavior, but no magic 0 value.

While we're in the same area, we can do minor cosmetic changes.
2020-03-27 20:18:54 -04:00
Phillip Stephens e0fe365dfd
Merge pull request #278 from lioncash/explicit
General: Make use of explicit constructors where applicable
2020-03-27 14:10:19 -07:00
Lioncash 241a66dc0a General: Make use of explicit constructors where applicable
Gets rid of potential error prone implicitly constructing constructors.
2020-03-27 06:00:17 -04:00
Lioncash fcf70aeb2a CGuiWidgetIdDB: Remove redundant std::make_pair funcs
Same behavior, less code.
2020-03-26 03:55:28 -04:00
Lioncash f4b3fb947e CScanDisplay: Make constructor explicit
Prevents error-prone implicit construction from occurring.
2020-03-25 20:46:08 -04:00
Luke Street 8314d5b6ef Merge branch 'pr-255' 2020-03-25 02:09:02 -04:00
Luke Street 3734a09ed3 CGuiWidget: Make GetIsFinishedLoading non-const 2020-03-25 02:01:47 -04:00
Lioncash 40fc3f9dd8 CModelBoo: Remove usages of const_cast
Many functions are modifying internals of CBooModel and const-casting
is performed in order to work around functions being const when they
really shouldn't be.

This amends the function signatures in order to allow these functions to
exist without const_cast, making code much nicer to read.
2020-03-25 02:01:46 -04:00
Lioncash fc4df76afc General: Make use of emplace_back where applicable
Allows for in-place construction. Also results in less code to read in
certain usages.
2020-03-21 00:30:12 -04:00
Luke Street 44325a5ad4
Merge pull request #248 from lioncash/slider
CGuiSliderGroup: Make use of std::array where applicable
2020-03-18 01:05:30 -04:00
Luke Street b13a6b491b
Merge pull request #245 from lioncash/drawstring
CDrawStringOptions: Resize vector within constructor
2020-03-18 01:04:08 -04:00
Luke Street 7c8de88fd7
Merge pull request #244 from lioncash/pane
CAui*: Make use of std::array where applicable
2020-03-18 01:03:50 -04:00
Lioncash 9d5857e139 CGuiSliderGroup: Make use of std::array where applicable
Same behavior, stronger typing.
2020-03-17 22:22:06 -04:00
Lioncash 1d6354ba26 CDrawStringOptions: Resize vector within constructor
Same behavior, but constructs the vector with the necessary size, rather
than constructing and resizing after the fact.
2020-03-17 21:35:08 -04:00
Lioncash fa6006003d CAuiEnergyBarT01: Make use of std::array where applicable
Same behavior, but allows dehardcoding array sizes.
2020-03-17 21:26:57 -04:00
Lioncash e534f00706 CAuiEnergyBarT01: Convert typedef into using alias
Same behavior, but nicer to read.
2020-03-17 21:24:01 -04:00
Lioncash 15e4d4aa01 CAuiImagePane: Make use of std::array where applicable
Same behavior, stronger typing.
2020-03-17 21:22:17 -04:00
Luke Street eeb09f512d
Merge pull request #220 from lioncash/array
CHud*: Make use of std::array where applicable
2020-03-15 19:56:33 -04:00
Luke Street e1d622d47b
Merge pull request #221 from lioncash/emplace
CFontImageDef: Make use of emplace_back where applicable
2020-03-15 19:44:23 -04:00
Lioncash e64dfe76b2 CFontImageDef: Make use of emplace_back where applicable
Same behavior, but constructs the instances directly within the
container.
2020-03-14 18:45:37 -04:00
Lioncash e0392d69c4 CHudEnergyInterface: Make use of std::array where applicable 2020-03-14 17:59:39 -04:00
Lioncash c4796ed090 CHudMissileInterface: Make use of std::array where applicable 2020-03-14 17:57:05 -04:00
Lioncash 9fafb24fb9 CHudVisorBeamMenu: Make use of std::array where applicable 2020-03-14 17:52:30 -04:00
Lioncash 07542ff335 CHudThreatInterface: Make use of std::array where applicable
Same behavior, but with stronger typing.
2020-03-14 17:38:57 -04:00
Lioncash 097d4a4422 Runtime: Collapse emplace_back() calls where applicable
Same behavior, but with less code.
2020-03-13 17:14:44 -04:00
Phillip Stephens b492c91ccf
Merge pull request #197 from lioncash/cond
CFontRenderState: Collapse common switch cases in RefreshColor()
2020-03-08 18:03:17 -07:00
Lioncash a490eaf8ff CFontRenderState: Collapse common switch cases in RefreshColor()
Same behavior, less code.
2020-03-07 03:44:54 -05:00
Lioncash 815a38288a CSaveableState: Initialize vectors in the constructor initializer list
Initializes the vectors in place, rather than constructing them and then
resizing.
2020-03-06 22:47:39 -05:00
Phillip Stephens 2f9dd38bbe
Silence discard errors 2020-03-04 18:40:03 -08:00
Lioncash f1256faeb7 Runtime: Remove unnecessary c_str() calls
Makes for less noisy code and also gets rid of unnecessary std::strlen
calls in the case things are passed to a std::string_view parameter.
2020-02-28 05:26:41 -05:00
Phillip Stephens b1322a5613
Merge pull request #133 from lioncash/trunc-float
CTextParser: Resolve double->float truncation within ParseTag()
2020-01-30 20:11:39 -08:00
Lioncash 03f2ebc768 CTextParser: Resolve double->float truncation within ParseTag()
This should be prepended with the f suffix to prevent double to float
implicit truncation.
2020-01-29 02:26:50 -05:00
Lioncash 7f20cd0883 CGuiTextSupport: Make use of emplace_back() in AddText()
Same behavior, less code.
2020-01-28 00:22:19 -05:00
Lioncash 221cc5c6b8 RuntimeCommonB: Normalize cpp file includes
Like the prior changes normalizing the inclusions within headers, this
tackles the cpp files of the RuntimeCommonB target, making these source
files consistent with their headers.
2019-12-22 18:12:04 -05:00