@@ -235,9 +235,7 @@ void NavMap3D::add_region(NavRegion3D *p_region) {
235
235
}
236
236
237
237
void NavMap3D::remove_region (NavRegion3D *p_region) {
238
- int64_t region_index = regions.find (p_region);
239
- if (region_index >= 0 ) {
240
- regions.remove_at_unordered (region_index);
238
+ if (regions.erase_unordered (p_region)) {
241
239
iteration_dirty = true ;
242
240
}
243
241
}
@@ -248,9 +246,7 @@ void NavMap3D::add_link(NavLink3D *p_link) {
248
246
}
249
247
250
248
void NavMap3D::remove_link (NavLink3D *p_link) {
251
- int64_t link_index = links.find (p_link);
252
- if (link_index >= 0 ) {
253
- links.remove_at_unordered (link_index);
249
+ if (links.erase_unordered (p_link)) {
254
250
iteration_dirty = true ;
255
251
}
256
252
}
@@ -268,9 +264,7 @@ void NavMap3D::add_agent(NavAgent3D *agent) {
268
264
269
265
void NavMap3D::remove_agent (NavAgent3D *agent) {
270
266
remove_agent_as_controlled (agent);
271
- int64_t agent_index = agents.find (agent);
272
- if (agent_index >= 0 ) {
273
- agents.remove_at_unordered (agent_index);
267
+ if (agents.erase_unordered (agent)) {
274
268
agents_dirty = true ;
275
269
}
276
270
}
@@ -292,9 +286,7 @@ void NavMap3D::add_obstacle(NavObstacle3D *obstacle) {
292
286
}
293
287
294
288
void NavMap3D::remove_obstacle (NavObstacle3D *obstacle) {
295
- int64_t obstacle_index = obstacles.find (obstacle);
296
- if (obstacle_index >= 0 ) {
297
- obstacles.remove_at_unordered (obstacle_index);
289
+ if (obstacles.erase_unordered (obstacle)) {
298
290
obstacles_dirty = true ;
299
291
}
300
292
}
@@ -323,14 +315,10 @@ void NavMap3D::set_agent_as_controlled(NavAgent3D *agent) {
323
315
}
324
316
325
317
void NavMap3D::remove_agent_as_controlled (NavAgent3D *agent) {
326
- int64_t agent_3d_index = active_3d_avoidance_agents.find (agent);
327
- if (agent_3d_index >= 0 ) {
328
- active_3d_avoidance_agents.remove_at_unordered (agent_3d_index);
318
+ if (active_3d_avoidance_agents.erase_unordered (agent)) {
329
319
agents_dirty = true ;
330
320
}
331
- int64_t agent_2d_index = active_2d_avoidance_agents.find (agent);
332
- if (agent_2d_index >= 0 ) {
333
- active_2d_avoidance_agents.remove_at_unordered (agent_2d_index);
321
+ if (active_2d_avoidance_agents.erase_unordered (agent)) {
334
322
agents_dirty = true ;
335
323
}
336
324
}
0 commit comments