Skip to content

Commit

Permalink
Sync different heal location array names
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Oct 11, 2024
1 parent 1045d02 commit f1ceabb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/heal_location.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static void SetWhiteoutRespawnHealerNpcAsLastTalked(u32 healLocationIdx);

// Arrays described here because mapjson will overrwrite the below data file

// sSpawnPoints
// sHealLocations
// This array defines the fly points for unlocked spawns.

// sWhiteoutRespawnHealCenterMapIdxs
Expand All @@ -30,8 +30,8 @@ static u32 GetHealLocationIndexFromMapGroupAndNum(u16 mapGroup, u16 mapNum)
{
u32 i;

for (i = 0; i < NELEMS(sSpawnPoints); i++) {
if (sSpawnPoints[i].mapGroup == mapGroup && sSpawnPoints[i].mapNum == mapNum)
for (i = 0; i < ARRAY_COUNT(sHealLocations); i++) {
if (sHealLocations[i].mapGroup == mapGroup && sHealLocations[i].mapNum == mapNum)
{
return i + 1;
}
Expand All @@ -46,16 +46,16 @@ static const struct HealLocation * GetHealLocationPointerFromMapGroupAndNum(u16
if (i == HEAL_LOCATION_NONE)
return NULL;

return &sSpawnPoints[i - 1];
return &sHealLocations[i - 1];
}

const struct HealLocation * GetHealLocation(u32 idx)
{
if (idx == HEAL_LOCATION_NONE)
return NULL;
if (idx > NELEMS(sSpawnPoints))
if (idx > ARRAY_COUNT(sHealLocations))
return NULL;
return &sSpawnPoints[idx - 1];
return &sHealLocations[idx - 1];
}

void SetWhiteoutRespawnWarpAndHealerNpc(struct WarpData * warp)
Expand Down
9 changes: 1 addition & 8 deletions tools/mapjson/mapjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,8 @@ void process_heal_locations(const vector<string> &map_filepaths, string output_f
ostringstream text;
text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/*/map.json\n//\n\n";

string arr_name;
if (version == "firered") {
arr_name = "sSpawnPoints";
} else {
arr_name = "sHealLocations";
}

string arr_body = heal_locations_text.str();
text << "static const struct HealLocation " << arr_name << "[] =\n{\n" << arr_body << "};\n\n";
text << "static const struct HealLocation sHealLocations[] =\n{\n" << arr_body << "};\n\n";

arr_body = respawn_maps_text.str();
if (!arr_body.empty())
Expand Down

0 comments on commit f1ceabb

Please sign in to comment.