mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-10-31 23:55:06 -04:00
Modify all (4) instances of Flags_GetRandomizerInf()
returns that were u8 to s32 to avoid value overflow. (#4463)
This commit is contained in:
parent
92c791b7c0
commit
17d8487730
@ -28,8 +28,8 @@ typedef struct {
|
||||
s16 rupees;
|
||||
s16 gsTokens;
|
||||
u8 isDoubleDefenseAcquired;
|
||||
u8 gregFound;
|
||||
u8 hasWallet;
|
||||
s32 gregFound;
|
||||
s32 hasWallet;
|
||||
} SaveFileMetaInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user