tumbledemerald-legacy/src/heal_location.c

38 lines
839 B
C
Raw Normal View History

2022-05-19 19:14:13 +02:00
#include "global.h"
#include "heal_location.h"
#include "constants/heal_locations.h"
#include "data/heal_locations.h"
u32 GetHealLocationIndexByMap(u16 mapGroup, u16 mapNum)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sHealLocations); i++)
{
if (sHealLocations[i].group == mapGroup && sHealLocations[i].map == mapNum)
return i + 1;
}
return 0;
}
const struct HealLocation *GetHealLocationByMap(u16 mapGroup, u16 mapNum)
{
u32 index = GetHealLocationIndexByMap(mapGroup, mapNum);
if (index == 0)
return NULL;
else
return &sHealLocations[index - 1];
}
const struct HealLocation *GetHealLocation(u32 index)
{
if (index == 0)
return NULL;
else if (index > ARRAY_COUNT(sHealLocations))
return NULL;
else
return &sHealLocations[index - 1];
}