forked from pret/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathheal_location.c
37 lines (31 loc) · 890 Bytes
/
heal_location.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#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 HEAL_LOCATION_NONE;
}
const struct HealLocation *GetHealLocationByMap(u16 mapGroup, u16 mapNum)
{
u32 index = GetHealLocationIndexByMap(mapGroup, mapNum);
if (index == HEAL_LOCATION_NONE)
return NULL;
else
return &sHealLocations[index - 1];
}
const struct HealLocation *GetHealLocation(u32 index)
{
if (index == HEAL_LOCATION_NONE)
return NULL;
else if (index > ARRAY_COUNT(sHealLocations))
return NULL;
else
return &sHealLocations[index - 1];
}