discard next segment properly

This commit is contained in:
Leijurv 2019-02-13 16:30:53 -08:00
parent 9ecd24c755
commit b2583773d5
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -463,8 +463,12 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
} else { } else {
if (next == null) { if (next == null) {
if (executor.isPresent()) { if (executor.isPresent()) {
queuePathEvent(PathEvent.NEXT_SEGMENT_CALC_FINISHED); if (executor.get().getPath().getSrc().equals(current.getPath().getDest())) {
next = executor.get(); queuePathEvent(PathEvent.NEXT_SEGMENT_CALC_FINISHED);
next = executor.get();
} else {
logDebug("Warning: discarding orphan next segment with incorrect start");
}
} else { } else {
queuePathEvent(PathEvent.NEXT_CALC_FAILED); queuePathEvent(PathEvent.NEXT_CALC_FAILED);
} }