Skip to content

Commit

Permalink
SaveTarget 0 EscapeTarget is always present
Browse files Browse the repository at this point in the history
  • Loading branch information
mateofio committed Nov 5, 2018
1 parent 0414174 commit bf85cb5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/game_targets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ std::vector<RPG::SaveTarget*> Game_Targets::GetTeleportTargets() {
}

void Game_Targets::SetEscapeTarget(int map_id, int x, int y, bool switch_on, int switch_id) {
std::vector<RPG::SaveTarget>::iterator target = FindTarget(0, true);
auto* target = &data[0];

target->map_id = map_id;
target->map_x = x;
Expand All @@ -97,11 +97,10 @@ void Game_Targets::SetEscapeTarget(int map_id, int x, int y, bool switch_on, int
}

bool Game_Targets::HasEscapeTarget() {
return GetEscapeTarget() != nullptr;
return data[0].map_id != 0;
}

RPG::SaveTarget* Game_Targets::GetEscapeTarget() {
std::vector<RPG::SaveTarget>::iterator target = FindTarget(0, false);
return target == data.end() ? NULL : &*target;
return HasEscapeTarget() ? &data[0] : nullptr;
}

0 comments on commit bf85cb5

Please sign in to comment.