pokeemerald/src/heal_location.c

39 lines
867 B
C
Raw Normal View History

2017-10-29 02:43:33 +02:00
#include "global.h"
#include "heal_location.h"
#include "constants/maps.h"
#include "constants/heal_locations.h"
2017-10-29 02:43:33 +02:00
#include "data/heal_locations.h"
2017-10-29 02:43:33 +02:00
u32 GetHealLocationIndexByMap(u16 mapGroup, u16 mapNum)
2017-10-29 02:55:01 +02:00
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sHealLocations); i++)
2017-10-29 02:55:01 +02:00
{
2017-10-29 02:44:52 +01:00
if (sHealLocations[i].group == mapGroup && sHealLocations[i].map == mapNum)
2017-10-29 02:55:01 +02:00
return i + 1;
}
return 0;
}
const struct HealLocation *GetHealLocationByMap(u16 mapGroup, u16 mapNum)
2017-10-29 02:55:01 +02:00
{
u32 index = GetHealLocationIndexByMap(mapGroup, mapNum);
2017-10-29 02:55:01 +02:00
if (index == 0)
2017-10-29 02:55:01 +02:00
return NULL;
else
return &sHealLocations[index - 1];
2017-10-29 02:55:01 +02:00
}
const struct HealLocation *GetHealLocation(u32 index)
2017-10-29 02:55:01 +02:00
{
if (index == 0)
2017-10-29 02:55:01 +02:00
return NULL;
else if (index > ARRAY_COUNT(sHealLocations))
2017-10-29 02:55:01 +02:00
return NULL;
else
return &sHealLocations[index - 1];
2017-10-29 02:55:01 +02:00
}