mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Remove redundancy in berry.c
This commit is contained in:
parent
bd766b9049
commit
15117a8d09
@ -2,11 +2,6 @@
|
||||
#define GUARD_BERRY_H
|
||||
|
||||
#define BERRY_NONE 0
|
||||
#define FIRST_BERRY ITEM_CHERI_BERRY
|
||||
#define LAST_BERRY ITEM_ENIGMA_BERRY
|
||||
|
||||
#define GETBERRYID(berry) ((berry - FIRST_BERRY) + 1)
|
||||
#define GETITEMID(berry) ((berry + FIRST_BERRY) - 1)
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -902,12 +902,12 @@ bool32 IsEnigmaBerryValid(void)
|
||||
|
||||
const struct Berry *GetBerryInfo(u8 berry)
|
||||
{
|
||||
if (berry == GETBERRYID(ITEM_ENIGMA_BERRY) && IsEnigmaBerryValid())
|
||||
if (berry == ITEM_TO_BERRY(ITEM_ENIGMA_BERRY) && IsEnigmaBerryValid())
|
||||
return (struct Berry*)(&gSaveBlock1Ptr->enigmaBerry.berry);
|
||||
else
|
||||
{
|
||||
if (berry == BERRY_NONE || berry > GETBERRYID(LAST_BERRY))
|
||||
berry = GETBERRYID(FIRST_BERRY);
|
||||
if (berry == BERRY_NONE || berry > ITEM_TO_BERRY(LAST_BERRY_INDEX))
|
||||
berry = ITEM_TO_BERRY(FIRST_BERRY_INDEX);
|
||||
return &gBerries[berry - 1];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user