Reduce allocations when solving path in AStarGrid2D
This commit is contained in:
parent
db66bd35af
commit
eaea7c1065
1 changed files with 2 additions and 1 deletions
|
@ -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…
Reference in a new issue