changeset 9224 | 93528d9cb96d |
parent 9111 | 48ce04029fe4 |
child 9234 | bfc9d27d3d0d |
9223:2e4d5d55bdf0 | 9224:93528d9cb96d |
---|---|
968 if (v->direction != u->direction || !(v->direction & 1)) return; |
968 if (v->direction != u->direction || !(v->direction & 1)) return; |
969 |
969 |
970 /* Check if vehicle is in a road stop, depot, tunnel or bridge or not on a straight road */ |
970 /* Check if vehicle is in a road stop, depot, tunnel or bridge or not on a straight road */ |
971 if (v->u.road.state >= RVSB_IN_ROAD_STOP || !IsStraightRoadTrackdir((Trackdir)(v->u.road.state & RVSB_TRACKDIR_MASK))) return; |
971 if (v->u.road.state >= RVSB_IN_ROAD_STOP || !IsStraightRoadTrackdir((Trackdir)(v->u.road.state & RVSB_TRACKDIR_MASK))) return; |
972 |
972 |
973 od.trackdir = DiagdirToDiagTrackdir(DirToDiagDir(v->direction)); |
973 od.trackdir = DiagDirToDiagTrackdir(DirToDiagDir(v->direction)); |
974 |
974 |
975 /* Are the current and the next tile suitable for overtaking? |
975 /* Are the current and the next tile suitable for overtaking? |
976 * - Does the track continue along od.trackdir |
976 * - Does the track continue along od.trackdir |
977 * - No junctions |
977 * - No junctions |
978 * - No barred levelcrossing |
978 * - No barred levelcrossing |
1133 |
1133 |
1134 case VPF_NPF: { /* NPF */ |
1134 case VPF_NPF: { /* NPF */ |
1135 NPFFindStationOrTileData fstd; |
1135 NPFFindStationOrTileData fstd; |
1136 |
1136 |
1137 NPFFillWithOrderData(&fstd, v); |
1137 NPFFillWithOrderData(&fstd, v); |
1138 Trackdir trackdir = DiagdirToDiagTrackdir(enterdir); |
1138 Trackdir trackdir = DiagDirToDiagTrackdir(enterdir); |
1139 //debug("Finding path. Enterdir: %d, Trackdir: %d", enterdir, trackdir); |
1139 //debug("Finding path. Enterdir: %d, Trackdir: %d", enterdir, trackdir); |
1140 |
1140 |
1141 NPFFoundTargetData ftd = PerfNPFRouteToStationOrTile(tile - TileOffsByDiagDir(enterdir), trackdir, true, &fstd, TRANSPORT_ROAD, v->u.road.compatible_roadtypes, v->owner, INVALID_RAILTYPES); |
1141 NPFFoundTargetData ftd = PerfNPFRouteToStationOrTile(tile - TileOffsByDiagDir(enterdir), trackdir, true, &fstd, TRANSPORT_ROAD, v->u.road.compatible_roadtypes, v->owner, INVALID_RAILTYPES); |
1142 if (ftd.best_trackdir == INVALID_TRACKDIR) { |
1142 if (ftd.best_trackdir == INVALID_TRACKDIR) { |
1143 /* We are already at our target. Just do something |
1143 /* We are already at our target. Just do something |
1323 } else if (IsRoadDepotTile(tile)) { |
1323 } else if (IsRoadDepotTile(tile)) { |
1324 diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile)); |
1324 diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile)); |
1325 } |
1325 } |
1326 |
1326 |
1327 if (diag_dir == INVALID_DIAGDIR) return INVALID_TRACKDIR; |
1327 if (diag_dir == INVALID_DIAGDIR) return INVALID_TRACKDIR; |
1328 dir = DiagdirToDiagTrackdir(diag_dir); |
1328 dir = DiagDirToDiagTrackdir(diag_dir); |
1329 } else { |
1329 } else { |
1330 if (already_reversed && prev->tile != tile) { |
1330 if (already_reversed && prev->tile != tile) { |
1331 /* |
1331 /* |
1332 * The vehicle has reversed, but did not go straight back. |
1332 * The vehicle has reversed, but did not go straight back. |
1333 * It immediatelly turn onto another tile. This means that |
1333 * It immediatelly turn onto another tile. This means that |