Ensure pathfinding on gridless is possible by always generating a pathfinding point when a virtual wall is being inserted

This commit is contained in:
Manuel Vögele
2022-02-17 00:53:51 +01:00
parent 074d2f5052
commit d6cccf4466
+2 -9
View File
@@ -188,18 +188,13 @@ impl Pathfinder {
if angle_diff <= PI { if angle_diff <= PI {
continue; continue;
} }
{
let angle_between = angle_diff / 2.0 + angle1; let angle_between = angle_diff / 2.0 + angle1;
let pathfinding_node = calc_pathfinding_node( nodes.push(calc_pathfinding_node(
point, point,
angle_between, angle_between,
distance_from_walls, distance_from_walls,
&mut line_segments, &mut line_segments,
); ));
if angle_diff > 1.5 * PI {
nodes.push(pathfinding_node);
}
}
nodes.push(calc_pathfinding_node( nodes.push(calc_pathfinding_node(
point, point,
angle1 + 0.5 * PI, angle1 + 0.5 * PI,
@@ -219,7 +214,6 @@ impl Pathfinder {
if angle_diff <= PI { if angle_diff <= PI {
continue; continue;
} }
if angle_diff > 1.5 * PI {
let angle_between = angle_diff / 2.0 + angle1; let angle_between = angle_diff / 2.0 + angle1;
nodes.push(calc_pathfinding_node( nodes.push(calc_pathfinding_node(
point, point,
@@ -227,7 +221,6 @@ impl Pathfinder {
distance_from_walls, distance_from_walls,
&mut line_segments, &mut line_segments,
)); ));
}
nodes.push(calc_pathfinding_node( nodes.push(calc_pathfinding_node(
point, point,
angle1 + 0.5 * PI, angle1 + 0.5 * PI,