Merge pull request #97843 from detomon/optimize-a-star-grid-2d-solve
Reduce allocations when solving path in `AStarGrid2D`
This commit is contained in:
commit
3b1a481f13
@ -503,6 +503,7 @@ bool AStarGrid2D::_solve(Point *p_begin_point, Point *p_end_point, bool p_allow_
|
||||
|
||||
LocalVector<Point *> open_list;
|
||||
SortArray<Point *, SortPoints> sorter;
|
||||
LocalVector<Point *> nbors;
|
||||
|
||||
p_begin_point->g_score = 0;
|
||||
p_begin_point->f_score = _estimate_cost(p_begin_point->id, p_end_point->id);
|
||||
@ -528,7 +529,7 @@ bool AStarGrid2D::_solve(Point *p_begin_point, Point *p_end_point, bool p_allow_
|
||||
open_list.remove_at(open_list.size() - 1);
|
||||
p->closed_pass = pass; // Mark the point as closed.
|
||||
|
||||
LocalVector<Point *> nbors;
|
||||
nbors.clear();
|
||||
_get_nbors(p, nbors);
|
||||
|
||||
for (Point *e : nbors) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user