Fixed waypoint path calculation

This commit is contained in:
Indyuce 2022-05-28 14:28:18 +02:00
parent 1f344dbe02
commit 0648079232

View File

@ -140,6 +140,10 @@ public class Waypoint extends PostLoadObject implements Unlockable {
while (pointsToCheck.size() != 0) { while (pointsToCheck.size() != 0) {
WaypointPath checked = pointsToCheck.get(0); WaypointPath checked = pointsToCheck.get(0);
pointsToCheck.remove(0); pointsToCheck.remove(0);
// If the point has already been checked, pass
if (checkedPoints.contains(checked.getFinalWaypoint()))
continue;
paths.add(checked); paths.add(checked);
checkedPoints.add(checked.getFinalWaypoint()); checkedPoints.add(checked.getFinalWaypoint());
@ -165,6 +169,10 @@ public class Waypoint extends PostLoadObject implements Unlockable {
while (pointsToCheck.size() != 0) { while (pointsToCheck.size() != 0) {
WaypointPath checked = pointsToCheck.get(0); WaypointPath checked = pointsToCheck.get(0);
pointsToCheck.remove(0); pointsToCheck.remove(0);
// If the point has already been checked, pass
if (checkedPoints.contains(checked.getFinalWaypoint()))
continue;
paths.add(checked); paths.add(checked);
checkedPoints.add(checked.getFinalWaypoint()); checkedPoints.add(checked.getFinalWaypoint());