You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
fixed AStar improper point deletion (leads to crash)
This commit is contained in:
@@ -97,12 +97,15 @@ void AStar::remove_point(int p_id) {
|
|||||||
|
|
||||||
Point *p = points[p_id];
|
Point *p = points[p_id];
|
||||||
|
|
||||||
for (Set<Point *>::Element *E = p->neighbours.front(); E; E = E->next()) {
|
Map<int, Point *>::Element *PE = points.front();
|
||||||
|
while (PE) {
|
||||||
|
for (Set<Point *>::Element *E = PE->get()->neighbours.front(); E; E = E->next()) {
|
||||||
Segment s(p_id, E->get()->id);
|
Segment s(p_id, E->get()->id);
|
||||||
segments.erase(s);
|
segments.erase(s);
|
||||||
E->get()->neighbours.erase(p);
|
E->get()->neighbours.erase(p);
|
||||||
}
|
}
|
||||||
|
PE = PE->next();
|
||||||
|
}
|
||||||
|
|
||||||
memdelete(p);
|
memdelete(p);
|
||||||
points.erase(p_id);
|
points.erase(p_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user