diff --git a/src/main/java/org/opentripplanner/routing/algorithm/RoutingWorker.java b/src/main/java/org/opentripplanner/routing/algorithm/RoutingWorker.java index d527aa2f40f..71fdca613d2 100644 --- a/src/main/java/org/opentripplanner/routing/algorithm/RoutingWorker.java +++ b/src/main/java/org/opentripplanner/routing/algorithm/RoutingWorker.java @@ -313,22 +313,7 @@ private boolean subwayHasNoOutOfSystemTransfer(Path path, TransitL leg = leg.nextLeg(); if (leg.isTransitLeg()) { if (leg.asTransitLeg().trip().getOriginalTripPattern().getMode() == TransitMode.SUBWAY) { - if (exitedSubway) { - //CANNOT RE-ENTER SUBWAY! ... - //... Unless this is an allowed out of system transfer - List stopLocations = transitLayer.getStopIndex().stopsByIndex; - StopLocation fromStopLocation = stopLocations.get(leg.fromStop()); - StopLocation toStopLocation = stopLocations.get(leg.toStop()); - org.opentripplanner.model.transfer.Transfer allowedTransfer = transitLayer.getTransferService().findStopToStopTransfer(fromStopLocation, toStopLocation); - if (allowedTransfer == null) - return false; - else { - exitedSubway = false; - enteredSubway = false; - } - } else { - enteredSubway = true; - } + enteredSubway = true; } } if (leg.isTransferLeg()) { @@ -354,6 +339,23 @@ private boolean subwayHasNoOutOfSystemTransfer(Path path, TransitL //We have entered non-subway transit therefore reset out of system subway tracking exitedSubway = false; enteredSubway = false; + continue; + } + if (exitedSubway) { + //CANNOT RE-ENTER SUBWAY! ... + //... Unless this is an allowed out of system transfer + List stopLocations = transitLayer.getStopIndex().stopsByIndex; + StopLocation fromStopLocation = stopLocations.get(leg.fromStop()); + StopLocation toStopLocation = stopLocations.get(leg.toStop()); + org.opentripplanner.model.transfer.Transfer allowedTransfer = transitLayer.getTransferService().findStopToStopTransfer(fromStopLocation, toStopLocation); + if (allowedTransfer == null) + return false; + else { + exitedSubway = false; + enteredSubway = false; + } + } else { + exitedSubway = true; } } }