Declarations for 2- and 3-argument GetMonData (#1756)
* Type-safe GetMonData/GetBoxMonData * Comments
This commit is contained in:
+1
-1
@@ -341,7 +341,7 @@ static void Debug_AddDaycareSteps(u16 numSteps)
|
||||
|
||||
u8 GetNumLevelsGainedFromDaycare(void)
|
||||
{
|
||||
if (GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[gSpecialVar_0x8004], MON_DATA_SPECIES) != 0)
|
||||
if (GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[gSpecialVar_0x8004].mon, MON_DATA_SPECIES) != 0)
|
||||
return GetNumLevelsGainedForDaycareMon(&gSaveBlock1Ptr->daycare.mons[gSpecialVar_0x8004]);
|
||||
|
||||
return 0;
|
||||
|
||||
+14
-2
@@ -3622,7 +3622,11 @@ static union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 perso
|
||||
return substruct;
|
||||
}
|
||||
|
||||
u32 GetMonData(struct Pokemon *mon, s32 field, u8 *data)
|
||||
/* GameFreak called GetMonData with either 2 or 3 arguments, for type
|
||||
* safety we have a GetMonData macro (in include/pokemon.h) which
|
||||
* dispatches to either GetMonData2 or GetMonData3 based on the number
|
||||
* of arguments. */
|
||||
u32 GetMonData3(struct Pokemon *mon, s32 field, u8 *data)
|
||||
{
|
||||
u32 ret;
|
||||
|
||||
@@ -3690,7 +3694,13 @@ u32 GetMonData(struct Pokemon *mon, s32 field, u8 *data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
||||
u32 GetMonData2(struct Pokemon *mon, s32 field) __attribute__((alias("GetMonData3")));
|
||||
|
||||
/* GameFreak called GetBoxMonData with either 2 or 3 arguments, for type
|
||||
* safety we have a GetBoxMonData macro (in include/pokemon.h) which
|
||||
* dispatches to either GetBoxMonData2 or GetBoxMonData3 based on the
|
||||
* number of arguments. */
|
||||
u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
||||
{
|
||||
s32 i;
|
||||
u32 retVal = 0;
|
||||
@@ -4046,6 +4056,8 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field) __attribute__((alias("GetBoxMonData3")));
|
||||
|
||||
#define SET8(lhs) (lhs) = *data
|
||||
#define SET16(lhs) (lhs) = data[0] + (data[1] << 8)
|
||||
#define SET32(lhs) (lhs) = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24)
|
||||
|
||||
Reference in New Issue
Block a user