diff options
| author | Malkierian <malkierian@gmail.com> | 2024-10-21 14:55:46 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-21 14:55:46 -0700 |
| commit | 17d8487730f722e6c156d6f547b7933dcbf13e50 (patch) | |
| tree | 41633e54197066f08f47c710ddc950bed82eb35e /soh/src/code | |
| parent | 92c791b7c0e6468da03096756b965d9264bd0eb2 (diff) | |
Modify all (4) instances of `Flags_GetRandomizerInf()` returns that were u8 to s32 to avoid value overflow. (#4463)
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/code_8006C3A0.c | 2 | ||||
| -rw-r--r-- | soh/src/code/z_actor.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/soh/src/code/code_8006C3A0.c b/soh/src/code/code_8006C3A0.c index d3397086e..b2b896cb8 100644 --- a/soh/src/code/code_8006C3A0.c +++ b/soh/src/code/code_8006C3A0.c @@ -29,5 +29,5 @@ s32 Flags_GetEnv(PlayState* play, s16 flag) { s16 bit = flag % 16; s16 mask = 1 << bit; - return play->envFlags[index] & mask; + return (play->envFlags[index] & mask) != 0; } diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index b9616a44a..dccb4d9bf 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -4971,7 +4971,7 @@ s32 Flags_GetRandomizerInf(RandomizerInf flag) { * Sets "randomizerInf" flag. */ void Flags_SetRandomizerInf(RandomizerInf flag) { - u8 previouslyOff = !Flags_GetRandomizerInf(flag); + s32 previouslyOff = !Flags_GetRandomizerInf(flag); gSaveContext.randomizerInf[flag >> 4] |= (1 << (flag & 0xF)); if (previouslyOff) { LUSLOG_INFO("RandomizerInf Flag Set - %#x", flag); @@ -4983,7 +4983,7 @@ void Flags_SetRandomizerInf(RandomizerInf flag) { * Unsets "randomizerInf" flag. */ void Flags_UnsetRandomizerInf(RandomizerInf flag) { - u8 previouslyOn = Flags_GetRandomizerInf(flag); + s32 previouslyOn = Flags_GetRandomizerInf(flag); gSaveContext.randomizerInf[flag >> 4] &= ~(1 << (flag & 0xF)); if (previouslyOn) { LUSLOG_INFO("RandomizerInf Flag Unset - %#x", flag); |
