Commit Graph

3325 Commits

Author SHA1 Message Date
Phillip Stephens 734f1d2db5
Merge pull request #264 from lioncash/move
General: Remove unnecessary std::move calls
2020-03-23 23:28:24 -07:00
Phillip Stephens 425f8d4cc8
Merge pull request #263 from lioncash/array3
CDecal: Make use of std::array where applicable
2020-03-23 23:28:08 -07:00
Phillip Stephens dbbf9e33fd
Merge pull request #262 from lioncash/nullopt
CBeamProjectile: Explicitly return std::nullopt in GetTouchBounds()
2020-03-23 23:27:54 -07:00
Phillip Stephens 1c841d10f8
Merge pull request #261 from lioncash/const7
CBomb: Make file-scope material filter constexpr
2020-03-23 23:27:39 -07:00
Phillip Stephens dc6954491b
Merge pull request #260 from lioncash/array2
CPlayerState: Make g_typeNameMap a compile-time array
2020-03-23 23:27:19 -07:00
Phillip Stephens 4dc73e56a0
Merge pull request #259 from lioncash/default
CPlayerState: Default CPowerUp constructor and also remove undefined behavior
2020-03-23 23:27:06 -07:00
Phillip Stephens 2e43266714
Merge pull request #258 from lioncash/emplaced
General: Make use of emplace_back where applicable
2020-03-23 23:26:51 -07:00
Phillip Stephens 6c7fdc11a0
Merge pull request #257 from lioncash/virt
CWorld: Rename IMapWorld to IGetMapWorld()
2020-03-23 23:26:35 -07:00
Phillip Stephens 6c9d6bc38b
Merge pull request #256 from lioncash/binding
CActorContraption: Make use of structured bindings where applicable
2020-03-23 23:26:19 -07:00
Lioncash 0e54861455 General: Remove unnecessary std::move calls
There's no real need to std::move a primitive type. A copy will be
performed either way. We can remove std::move in this case to improve
readability.
2020-03-22 00:56:04 -04:00
Lioncash 2b4b7c36a5 CDecal: Make use of std::array where applicable
Same behavior, but with stronger-typing and no implicit array to pointer
decay.
2020-03-21 01:53:41 -04:00
Lioncash bf590dd855 CBeamProjectile: Explicitly return std::nullopt in GetTouchBounds()
Allows some implementations to completely avoid zeroing out the internal
buffer within the std::optional instance.
2020-03-21 01:46:59 -04:00
Lioncash 5b7e440ff7 CBomb: Make file-scope material filter constexpr
Allows the data to be placed into the read-only segment.
2020-03-21 01:42:46 -04:00
Lioncash 83c9af9153 CPlayerState: Make g_typeNameMap a compile-time array
While useful as a map, this causes an allocation that occurs during
program start and lasts until the program terminates, even if the
relevant code is never executed.

Given the total number of elements is quite small, we can convert this
into a compile-time array and perform the lookup with that instead.
While we're at it, we can eliminate an unnecessary second lookup into
said array by reusing the iterator from the first find.
2020-03-21 00:57:05 -04:00
Lioncash ff703b1189 CPlayerState: Remove undefined behavior within CPlayerState constructor
Type-punning via a union is currently undefined behavior according to
the C++ standard, so we can use std::memcpy instead to accomplish the
same thing.
2020-03-21 00:39:40 -04:00
Lioncash ba6f55a928 CPlayerState: Default CPowerUp constructor
Same behavior but allows the constructor to be considered trivial.

While we're at it, we can make the constructors constexpr, considering
the data structure only holds two primitives.
2020-03-21 00:34:16 -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
Lioncash 8a9e76a345 CWorld: Rename IMapWorld to IGetMapWorld()
Allows const overloading to function properly and prevents potential
compilation errors from occurring if constness on functions is ever
changed.
2020-03-20 23:27:07 -04:00
Lioncash 0cc8e76d64 CActorContraption: Make use of structured bindings where applicable
Same behavior, but with better names than `first` or `second`.
2020-03-20 23:13:29 -04:00
Luke Street 36ac0a8d78 CStateManager: Fix CMapWorld const reference 2020-03-18 01:18:00 -04:00
Luke Street 9e05819f05
Merge pull request #253 from lioncash/const4
CRelayTracker: Make HasRelay() a const member function
2020-03-18 01:09:31 -04:00
Luke Street f6e2f196ce
Merge pull request #252 from lioncash/resize2
CRumbleVoice: Resize vectors within constructor initializer list
2020-03-18 01:09:09 -04:00
Luke Street 92c9ec02e5
Merge pull request #251 from lioncash/rumble
CInputGenerator: Make use of std::array where applicable
2020-03-18 01:08:12 -04:00
Luke Street dcf96e9826
Merge pull request #250 from lioncash/statemgr
CStateManager: Make use of std::array where applicable
2020-03-18 01:07:21 -04:00
Luke Street 93be0fbc72
Merge pull request #249 from lioncash/list
CObjectList: Make use of std::array where applicable
2020-03-18 01:05:42 -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 a7b2ad15dc
Merge pull request #247 from lioncash/sign-mismatch
CFlameThrower: Resolve sign-conversion warnings in DoCollisionCheck()
2020-03-18 01:05:16 -04:00
Luke Street 66c321d4a8
Merge pull request #246 from lioncash/def
CCollisionInfoList: Simplify definition of begin() and end()
2020-03-18 01:04:19 -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 cb4884fcef CRelayTracker: Make HasRelay() a const member function
While we're at it, we can make use of HasRelay() internally where
applicable to simplify code a little bit.
2020-03-18 01:03:35 -04:00
Luke Street dcc7affb8f
Merge pull request #243 from lioncash/light
CLight: Minor cleanup
2020-03-18 01:03:04 -04:00
Luke Street b3b8c33006
Merge pull request #242 from lioncash/const2
CMapWorld: Minor changes
2020-03-18 01:01:45 -04:00
Luke Street cecac3472a
Merge pull request #241 from lioncash/float
CMapArea: Minor changes
2020-03-18 01:00:20 -04:00
Luke Street a1c8867e83
Merge pull request #240 from lioncash/move
CMainFlow: std::move shared_ptr in SetGameState
2020-03-18 00:59:24 -04:00
Luke Street 18ef68df2a
Merge pull request #239 from lioncash/line
CLineRenderer: Minor changes
2020-03-18 00:58:46 -04:00
Luke Street dc0c721af7
Merge pull request #238 from lioncash/array2
CFogVolumeFilter: Make use of std::array where applicable
2020-03-18 00:58:28 -04:00
Luke Street fcf7044bf2 Merge remote-tracking branch 'github/recovery' 2020-03-18 00:45:49 -04:00
Lioncash 488e377374 CRumbleVoice: Collapse repeated std::max calls in GetIntensity()
We can make use of the std::max overload that takes an initializer list.
2020-03-18 00:34:29 -04:00
Lioncash 71399d0944 CRumbleVoice: Correct bool->s16 conversion
Given the return type of the function is an s16, we can just use 0
directly here.
2020-03-18 00:32:51 -04:00
Lioncash 2701f060ee CRumbleVoice: Resize vectors within constructor initializer list
Same behavior, but constructs in place with the size, rather than
constructing and then resizing.

x20_handleIds cannot be done the same way unfortunately, as
reserved_vector doesn't have a constructor accepting a size argument
like std::vector does.
2020-03-18 00:28:44 -04:00
Lioncash e83d5caea6 CInputGenerator: Make use of std::array where applicable
Allows removing hardcoded array sizes.
2020-03-17 23:29:11 -04:00
Lioncash bf11be46ad CStateManager: Make use of std::array where applicable
Same behavior, but allows dehardcoding array sizes and makes the array
types more strongly typed.
2020-03-17 23:10:41 -04:00
Lioncash 9e6f86cb16 CObjectList: Make use of std::array where applicable
Same behavior, but with stronger typing.
2020-03-17 22:38:21 -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 fc466ff062 CFlameThrower: Resolve sign-conversion warnings in DoCollisionCheck()
Resolves trivial sign conversion warnings and also makes some variables
const where applicable.
2020-03-17 21:55:24 -04:00
Lioncash 457c116275 CCollisionInfoList: Simplify definition of begin() and end()
Same behavior, but without a verbose return type.
2020-03-17 21:41:54 -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