diff options
author | Andrea Catania <info@andreacatania.com> | 2020-02-24 18:09:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 18:09:14 +0100 |
commit | c16711b1556ba2a9b6191b8aa344aca113130085 (patch) | |
tree | 1cbe3c24b3c1a805dd4f8999e82e7b83190b74e2 /modules/gdnavigation/nav_map.cpp | |
parent | a24aafcb92992f860694bf411acab1080fc0b3db (diff) |
Fixed remove region method.
Diffstat (limited to 'modules/gdnavigation/nav_map.cpp')
-rw-r--r-- | modules/gdnavigation/nav_map.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/gdnavigation/nav_map.cpp b/modules/gdnavigation/nav_map.cpp index d3e2f8f388..c3880f89b6 100644 --- a/modules/gdnavigation/nav_map.cpp +++ b/modules/gdnavigation/nav_map.cpp @@ -545,8 +545,11 @@ void NavMap::add_region(NavRegion *p_region) { } void NavMap::remove_region(NavRegion *p_region) { - regions.push_back(p_region); - regenerate_links = true; + std::vector<NavRegion *>::iterator it = std::find(regions.begin(), regions.end(), p_region); + if (it != regions.end()) { + regions.erase(it); + regenerate_links = true; + } } bool NavMap::has_agent(RvoAgent *agent) const { |