Lioncash
6ec903f9ac
CPlayer: Use std::array where applicable
...
Makes the arrays strongly-typed and impervious to implicit
array->pointer decay. We can also eliminate a few hardcoded magic
values.
2019-09-18 12:28:44 -04:00
Lioncash
70fb763180
CPlayer: Enclose translation-unit-local data within an anonymous namespace
...
Keeps all local data within one spot and prevents any potential ODR
violations related to them from occurring.
2019-09-18 12:27:15 -04:00
Lioncash
33f10e2552
CPlayer: Organize includes
2019-09-18 11:50:26 -04:00
Phillip Stephens
b5d829379e
Merge pull request #73 from lioncash/size
...
CPlayer: Use size_t with SfxIdFromMaterial
2019-09-18 01:41:47 -07:00
Lioncash
45cdc38ac0
CPlayer: Use size_t with SfxIdFromMaterial
...
Allows passing in sizes without potential truncation from size_t,
allowing nicer use of std::size() to dehardcode some magic values.
2019-09-17 14:52:42 -04:00
Phillip Stephens
5b4580e5bf
Merge pull request #72 from lioncash/array
...
CMorphBall: Use std::array where applicable
2019-09-17 01:30:44 -07:00
Lioncash
96f035f24b
CMorphBall: Use std::array where applicable
...
Makes the arrays strongly-typed and impervious to implicit
array->pointer decay.
This also uncovered an out of bounds memory read within UpdateEffects
cause by said array->pointer decay.
2019-09-16 21:11:30 -04:00
Lioncash
e4b22ea9d8
CMorphBall: Place internally linked data within an anonymous namespace
...
Keeps all internal data within one place and also prevents any potential
ODR violations from occurring in relation to any of these.
2019-09-16 14:53:52 -04:00
Lioncash
8c59ace5fe
CMorphBall: Clean up includes
2019-09-16 14:43:33 -04:00
Phillip Stephens
823df9643a
Merge pull request #71 from lioncash/enum
...
CSortedLists: Minor changes
2019-09-15 22:06:06 -07:00
Phillip Stephens
3e9cb69c32
Merge pull request #70 from lioncash/move
...
CEntityInfo: std::move vector in constructor
2019-09-15 22:05:57 -07:00
Lioncash
a5ab077dc3
CSortedLists: Use std::array where applicable
...
Prevents implicit array to pointer decay and allows us to simplify a bit
of the code.
2019-09-15 19:27:19 -04:00
Lioncash
f5d486f0ca
CSortedLists: Turn ESortedList into an enum class
...
Prevents namespace pollution and makes the type more strongly-enforced
with regards to implicit conversions
2019-09-15 18:52:02 -04:00
Lioncash
0281029015
CEntityInfo: std::move vector in constructor
...
Allows calling code to potentially avoid copies altogether by moving
into the constructor.
2019-09-15 16:22:35 -04:00
Phillip Stephens
cc236dcaba
Merge pull request #69 from lioncash/frontend
...
CFrontEndUI: Use std::array where applicable
2019-09-14 19:24:12 -07:00
Phillip Stephens
0120a43e0e
Merge pull request #68 from lioncash/insensitive
...
CStringExtras: Prevent potential out of bounds reads with CompareCaseInsensitive
2019-09-14 19:23:59 -07:00
Lioncash
991d048694
CStringExtras: Prevent undefined behavior within IndexOfSubstring
...
Unlikely to occur, but does completely prevent the case of undefined
behavior if a non-ascii character ends up within the given string.
2019-09-14 16:43:06 -04:00
Lioncash
0d2b2f45a8
CStringExtras: Prevent potential out of bounds reads with CompareCaseInsensitive
...
The strcasecmp and _stricmp functions expect the passed in strings to
be null-terminated, however we we're also exposing a std::string_view
overload for that function. std::string_view instances aren't required
to be null-terminated, so this makes the interface a little unsafe.
We can use std::lexicographical_compare() to provide the same behavior
and also properly handle the case of non-null-terminated strings.
2019-09-14 16:43:04 -04:00
Lioncash
86218421f5
CFrontEndUI: Use std::array where applicable
...
Makes the array types strongly-typed and also allows us to eliminate a
few magic values within the code.
2019-09-14 16:26:29 -04:00
Lioncash
b6ea391755
CFrontEndUI: Enclose file-local data within an anonymous namespace
...
Gets rid of the need to write static, and also makes it impossible to
violate the ODR for any declared types within the namespace (e.g.
FEMovie).
2019-09-14 15:45:17 -04:00
Lioncash
2a10e547d2
CFrontEndUI: Sort includes
...
Tidies up the includes for the translation unit and alphabetizes them
for easier reading.
2019-09-14 15:42:12 -04:00
Phillip Stephens
9b816d471b
Compile fixes
2019-09-14 10:08:09 -07:00
Phillip Stephens
30fb3827cd
Update submodules
2019-09-14 08:47:26 -07:00
Phillip Stephens
16ce349f1c
Merge pull request #67 from lioncash/endian
...
General: Be explicit about athena's Endian type
2019-09-14 08:38:53 -07:00
Lioncash
5b7f159233
General: Be explicit about athena's Endian type
...
Allows this code to still compile if the Endian type is ever changed
into a strong enumeration.
2019-09-14 11:01:01 -04:00
Phillip Stephens
002ca71104
Update hecl
2019-09-13 00:12:09 -07:00
Phillip Stephens
613f690c42
Merge pull request #66 from lioncash/lockfire
...
CCompoundTargetReticle: Fix typo in lock fire string
2019-09-13 00:11:37 -07:00
Phillip Stephens
4004876a6d
Merge pull request #65 from lioncash/unique
...
Runtime: Make use of std::make_unique where applicable
2019-09-13 00:10:43 -07:00
Lioncash
0aa749ce0c
CCompoundTargetReticle: Fix typo in lock fire string
...
In the actual game executable, the string is stored with a lower-case 'i', not an upper-case one.
2019-09-12 06:40:52 -04:00
Lioncash
20696fd500
CCompoundTargetReticle: Declare file-scope strings as arrays
...
Reduces the overall size of the resulting binary, as only the string
data will be stored rather than the string and a pointer pointing to
said string data.
2019-09-12 06:38:05 -04:00
Lioncash
267fd2962a
CCompoundTargetReticle: Move private strings into the cpp file
...
This is an internal detail, so we don't need to expose this in the
header,
2019-09-12 05:45:53 -04:00
Lioncash
f9079f0215
Runtime: Make use of std::make_unique where applicable
...
Makes use of the C++14 make_unique allocation function to allocate class
instances where applicable instead of a reset with a new operator within
it.
This doesn't touch cases where buffers are allocated, given make_unique
would zero-initialize them.
2019-09-12 04:09:48 -04:00
Phillip Stephens
d6166ad666
Update amuse
2019-09-10 23:55:51 -07:00
Phillip Stephens
28f8843e5e
Merge pull request #64 from lioncash/constexpr
...
CRumbleVoice: Make SAdsrData and SAdsrDelta interfaces constexpr
2019-09-10 23:55:12 -07:00
Lioncash
9983366a53
RumbleFxTable: Use std::array for the lookup table
...
Strongly enforces the type of the array and also allows size querying,
etc, directly from the type.
2019-09-10 19:13:34 -04:00
Lioncash
d7493d5920
CRumbleVoice: Make SAdsrDelta interface constexpr
...
Makes the API consistent between SAdsrData and SAdsrDelta.
2019-09-10 19:13:34 -04:00
Lioncash
6ca5143b15
CRumbleVoice: Make SAdsrData constructors constexpr
...
Technically all file-scope instances have runtime-static constructors
otherwise. This allows the compiler to completely elide them from a
language point of view.
2019-09-10 19:02:22 -04:00
Phillip Stephens
1b1cc42139
Update submodules
2019-09-10 04:08:22 -07:00
Phillip Stephens
60409d2f6a
Merge pull request #63 from lioncash/char
...
CActorModelParticles: Make DGRP array constexpr
2019-09-10 04:03:06 -07:00
Lioncash
5baf3206f4
CActorModelParticles: Make DGRP array constexpr
...
Technically this array wasn't readonly and contained a sequence of
modifiable elements. We can make this constexpr so that the compiler can
definitively place it into the read-only segment.
2019-09-09 20:44:23 -04:00
Phillip Stephens
e2ab93dfac
Update submodules
2019-09-09 04:21:01 -07:00
Phillip Stephens
f07fc458d2
Merge pull request #62 from lioncash/crc
...
CCRC32: Move table declaration into the cpp file
2019-09-08 17:49:44 -07:00
Phillip Stephens
fae4fe9bf1
Merge pull request #61 from lioncash/ai
...
CAiFuncMap: Minor cleanup
2019-09-08 17:49:34 -07:00
Phillip Stephens
fa1b3a5a12
Merge pull request #60 from lioncash/athena
...
DataSpec: Be explicit about athena's SeekOrigin type
2019-09-08 17:49:25 -07:00
Lioncash
f430a00314
CCRC32: Move table declaration into the cpp file
...
This can be moved entirely into the cpp file, making it an
implementation detail.
2019-09-08 18:18:29 -04:00
Lioncash
c9271809a7
CAiFuncMap: Remove unused static std::vector
...
This isn't used, so we can remove it and get rid of a static
constructor.
2019-09-08 18:08:10 -04:00
Lioncash
20a0585cc5
CAiFuncMap: Convert typedefs into type aliases
...
Same thing, but reads a little nicer.
2019-09-08 18:08:10 -04:00
Lioncash
2f06fcba0a
CAiFuncMap: Avoid redundant map lookups in getters
...
We can just use the result of the find operation instead of rehashing
into the map to retrieve the entry.
This also allows us to make the getter const qualified.
2019-09-08 18:08:10 -04:00
Lioncash
1cfe83d8d1
CAiFuncMap: Replace map indexing with emplace in the constructor
...
Provides the same behavior, but without default initializing a map entry
that immediately gets overridden in the assignment.
2019-09-08 18:08:10 -04:00
Lioncash
bf818a883e
DataSpec: Be explicit about athena's SeekOrigin type
...
This was missed in 9c0d13f001
2019-09-08 16:44:02 -04:00