Skip to content

Commit

Permalink
Sort teleport targets when adding them
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Mar 8, 2023
1 parent 121d0f5 commit 3e5424f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/game_targets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ void Game_Targets::AddTeleportTarget(int map_id, int x, int y, bool switch_on, i
iter->map_y = y;
iter->switch_on = switch_on;
iter->switch_id = switch_id;

// Teleports must be sorted by map id.
std::sort(teleports.begin(), teleports.end(), [](auto& l, auto& r) { return l.map_id < r.map_id; });
}

void Game_Targets::RemoveTeleportTarget(int map_id) {
Expand Down

0 comments on commit 3e5424f

Please sign in to comment.