@@ -1293,11 +1293,14 @@ ref nextLaneId.ToLane(),
12931293 queueItem_ . pathType == ExtPathType . DrivingOnly )
12941294 // NON-STOCK CODE END
12951295 ) {
1296- bool isPrevSegmentPedZoneRoad = prevSegmentInfo . IsPedestrianZoneOrPublicTransportRoad ( ) ;
12971296 for ( int i = 0 ; i < 8 ; i ++ )
12981297 {
12991298 ushort nextPedZoneSegmentId = nextNode . GetSegment ( i ) ;
1300- if ( nextPedZoneSegmentId != 0 && nextPedZoneSegmentId != prevSegmentId && isPrevSegmentPedZoneRoad ) {
1299+ if ( nextPedZoneSegmentId != 0 && nextPedZoneSegmentId != prevSegmentId )
1300+ {
1301+ ref NetSegment nextPedZoneSegment = ref nextPedZoneSegmentId . ToSegment ( ) ;
1302+ if ( nextPedZoneSegment . Info . IsPedestrianZoneOrPublicTransportRoad ( ) )
1303+ {
13011304 ProcessItemCosts (
13021305#if DEBUG
13031306 isLogEnabled ,
@@ -1312,14 +1315,15 @@ ref nextLaneId.ToLane(),
13121315 ref nextNode ,
13131316 false ,
13141317 nextPedZoneSegmentId ,
1315- ref nextPedZoneSegmentId . ToSegment ( ) ,
1318+ ref nextPedZoneSegment ,
13161319 ref prevRelSimilarLaneIndex ,
13171320 connectOffset ,
13181321 false ,
13191322 true ) ;
13201323 }
13211324 }
13221325 }
1326+ }
13231327 } else {
13241328 if ( isLogEnabled ) {
13251329 DebugLog (
@@ -2290,10 +2294,9 @@ private void ProcessItemPublicTransport(
22902294 Randomizer randomizer = new Randomizer ( pathFindIndex_ ^ nextLaneId ) ;
22912295 newDistance *= randomizer . Int32 ( 10000U ) * ( 1f / 1000f ) ;
22922296 }
2293- nextItem . ComparisonValue = comparisonValue +
2294- ( newDistance /
2297+ float currentComparisonValue = ( newDistance /
22952298 ( ( prevMaxSpeed + nextMaxSpeed ) * 0.5f * maxLength_ ) ) ;
2296- nextItem . Duration = duration + ( distance / ( ( prevMaxSpeed + nextMaxSpeed ) * 0.5f ) ) ;
2299+ float currentDuration = ( distance / ( ( prevMaxSpeed + nextMaxSpeed ) * 0.5f ) ) ;
22972300
22982301 nextItem . Direction =
22992302 ( nextSegment . m_flags & NetSegment . Flags . Invert ) != NetSegment . Flags . None
@@ -2331,9 +2334,8 @@ private void ProcessItemPublicTransport(
23312334 float nextOffset = Mathf . Abs ( nextItem . Position . m_offset - startOffsetA_ ) *
23322335 BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR ;
23332336
2334- nextItem . ComparisonValue +=
2335- nextOffset * nextSegment . m_averageLength / ( nextSpeed * maxLength_ ) ;
2336- nextItem . Duration += nextOffset * nextSegment . m_averageLength / nextSpeed ;
2337+ currentComparisonValue += nextOffset * nextSegment . m_averageLength / ( nextSpeed * maxLength_ ) ;
2338+ currentDuration += nextOffset * nextSegment . m_averageLength / nextSpeed ;
23372339 }
23382340
23392341 if ( nextLaneId == startLaneB_ ) {
@@ -2367,11 +2369,12 @@ private void ProcessItemPublicTransport(
23672369 float nextOffset = Mathf . Abs ( nextItem . Position . m_offset - startOffsetB_ ) *
23682370 BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR ;
23692371
2370- nextItem . ComparisonValue +=
2371- nextOffset * nextSegment . m_averageLength / ( nextSpeed * maxLength_ ) ;
2372- nextItem . Duration += nextOffset * nextSegment . m_averageLength / nextSpeed ;
2372+ currentComparisonValue += nextOffset * nextSegment . m_averageLength / ( nextSpeed * maxLength_ ) ;
2373+ currentDuration += nextOffset * nextSegment . m_averageLength / nextSpeed ;
23732374 }
23742375
2376+ nextItem . ComparisonValue = comparisonValue + currentComparisonValue ;
2377+ nextItem . Duration = duration + currentDuration ;
23752378 nextItem . LaneId = nextLaneId ;
23762379 nextItem . LanesUsed = item . LanesUsed | nextLaneInfo . m_laneType ;
23772380 nextItem . VehiclesUsed = item . VehiclesUsed | nextLaneInfo . m_vehicleType ;
@@ -2692,6 +2695,7 @@ private bool ProcessItemCosts(
26922695
26932696 NetInfo . LaneType allowedLaneTypes = laneTypes_;
26942697 VehicleInfo. VehicleType allowedVehicleTypes = vehicleTypes_;
2698+ VehicleInfo. VehicleCategory currentVehicleCategory = vehicleCategory_;
26952699 if ( ! enableVehicle ) {
26962700 allowedVehicleTypes &= VehicleInfo . VehicleType . Bicycle ;
26972701 if ( allowedVehicleTypes == VehicleInfo . VehicleType . None ) {
@@ -2700,6 +2704,10 @@ private bool ProcessItemCosts(
27002704 }
27012705 }
27022706
2707+ if ( ignoreBlocked_ ) {
2708+ currentVehicleCategory = VehicleInfo . VehicleCategory . All ;
2709+ }
2710+
27032711 if ( ! enablePedestrian ) {
27042712 allowedLaneTypes &= ~ NetInfo . LaneType . Pedestrian ;
27052713 }
@@ -2782,7 +2790,6 @@ private bool ProcessItemCosts(
27822790 }
27832791#endif
27842792
2785- var currentVehicleCategory = vehicleCategory_ ;
27862793 // NON-STOCK CODE END
27872794 for ( ; nextLaneIndex <= maxNextLaneIndex && nextLaneId != 0 ; nextLaneIndex ++ ) {
27882795 NetInfo . Lane nextLaneInfo = nextSegmentInfo . m_lanes [ nextLaneIndex ] ;
@@ -2934,8 +2941,8 @@ private bool ProcessItemCosts(
29342941 }
29352942
29362943 // NON-STOCK CODE END
2937- nextItem . ComparisonValue = comparisonValue + transitionCostOverMeanMaxSpeed ;
2938- nextItem . Duration = duration + transitionCost / ( ( prevMaxSpeed + nextMaxSpeed ) * 0.5f ) ;
2944+ float currentComparisonValue = transitionCostOverMeanMaxSpeed ;
2945+ float currentDuration = transitionCost / ( ( prevMaxSpeed + nextMaxSpeed ) * 0.5f ) ;
29392946 nextItem . Direction = nextDir ;
29402947
29412948 if ( nextLaneId == startLaneA_ ) {
@@ -2972,10 +2979,10 @@ private bool ProcessItemCosts(
29722979 float nextOffset = Mathf . Abs ( nextItem . Position . m_offset - startOffsetA_ ) *
29732980 BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR ;
29742981
2975- nextItem . ComparisonValue +=
2982+ currentComparisonValue +=
29762983 nextOffset * nextSegment . m_averageLength /
29772984 ( nextLaneSpeed * maxLength_ ) ;
2978- nextItem . Duration +=
2985+ currentDuration +=
29792986 nextOffset * nextSegment . m_averageLength / nextLaneSpeed ;
29802987 }
29812988
@@ -3013,10 +3020,10 @@ private bool ProcessItemCosts(
30133020 float nextOffset = Mathf . Abs ( nextItem . Position . m_offset - startOffsetB_ ) *
30143021 BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR ;
30153022
3016- nextItem . ComparisonValue +=
3023+ currentComparisonValue +=
30173024 nextOffset * nextSegment . m_averageLength /
30183025 ( nextLaneSpeed * maxLength_ ) ;
3019- nextItem . Duration +=
3026+ currentDuration +=
30203027 nextOffset * nextSegment . m_averageLength / nextLaneSpeed ;
30213028 }
30223029
@@ -3026,7 +3033,7 @@ private bool ProcessItemCosts(
30263033 ( nextLaneInfo . m_laneType &
30273034 ( NetInfo . LaneType . Vehicle | NetInfo . LaneType . TransportVehicle ) ) !=
30283035 NetInfo . LaneType . None ) {
3029- nextItem . ComparisonValue += 0.1f ;
3036+ currentComparisonValue += 0.1f ;
30303037 blocked = true ;
30313038 if ( ( allowedVehicleTypes & VehicleInfo . VehicleType . Plane ) != 0 )
30323039 {
@@ -3063,7 +3070,7 @@ private bool ProcessItemCosts(
30633070 }
30643071 }
30653072
3066- nextItem . ComparisonValue += adjustedBaseLength ;
3073+ currentComparisonValue += adjustedBaseLength ;
30673074
30683075 if ( isLogEnabled ) {
30693076 DebugLog (
@@ -3084,7 +3091,7 @@ private bool ProcessItemCosts(
30843091 // apply lane distance factor
30853092 float adjustedBaseLength = baseLength ;
30863093 adjustedBaseLength *= 1 + laneDist ;
3087- nextItem . ComparisonValue += adjustedBaseLength ;
3094+ currentComparisonValue += adjustedBaseLength ;
30883095
30893096 if ( isLogEnabled ) {
30903097 DebugLog (
@@ -3111,7 +3118,7 @@ private bool ProcessItemCosts(
31113118 int lastTarget = nextLane . m_lastTarget ;
31123119 if ( laneIndexFromInner < firstTarget ||
31133120 laneIndexFromInner >= lastTarget ) {
3114- nextItem . ComparisonValue +=
3121+ currentComparisonValue +=
31153122 Mathf . Max ( 1f , ( transitionCost * 3f ) - 3f ) /
31163123 ( ( prevMaxSpeed + nextMaxSpeed ) * 0.5f * maxLength_ ) ;
31173124 }
@@ -3134,7 +3141,7 @@ private bool ProcessItemCosts(
31343141
31353142 if ( ! transportVehicle_ && nextLaneInfo . m_laneType ==
31363143 NetInfo . LaneType . TransportVehicle ) {
3137- nextItem . ComparisonValue +=
3144+ currentComparisonValue +=
31383145 20f / ( ( prevMaxSpeed + nextMaxSpeed ) * 0.5f * maxLength_ ) ;
31393146 }
31403147 }
@@ -3151,9 +3158,11 @@ private bool ProcessItemCosts(
31513158
31523159 if ( ( nextLaneInfo . vehicleCategory & VehicleInfo . VehicleCategory . PublicTransportRoad ) != 0 &&
31533160 ( nextLaneInfo . vehicleCategory & ~ ( VehicleInfo . VehicleCategory . Bus | VehicleInfo . VehicleCategory . Trolleybus | VehicleInfo . VehicleCategory . Taxi ) ) == 0 ) {
3154- nextItem . ComparisonValue -= baseLength * 0.25f ;
3161+ currentComparisonValue -= baseLength * 0.25f ;
31553162 }
31563163
3164+ nextItem . ComparisonValue = comparisonValue + currentComparisonValue ;
3165+ nextItem . Duration = duration + currentDuration ;
31573166 AddBufferItem (
31583167#if DEBUG
31593168 isLogEnabled ,
@@ -3437,10 +3446,9 @@ private void ProcessItemPedBicycle(
34373446 var nextMaxSpeed = nextLaneInfo . m_speedLimit ;
34383447#endif
34393448
3440- nextItem . ComparisonValue = comparisonValue +
3441- distance /
3449+ float currentComparisonValue = distance /
34423450 ( ( prevMaxSpeed + nextMaxSpeed ) * 0.25f * maxLength_ ) ;
3443- nextItem . Duration = duration + ( distance / ( ( prevMaxSpeed + nextMaxSpeed ) * 0.5f ) ) ;
3451+ float currentDuration = ( distance / ( ( prevMaxSpeed + nextMaxSpeed ) * 0.5f ) ) ;
34443452
34453453 nextItem . Direction =
34463454 ( nextSegment . m_flags & NetSegment . Flags . Invert ) != NetSegment . Flags . None
@@ -3477,9 +3485,8 @@ private void ProcessItemPedBicycle(
34773485 float nextOffset = Mathf . Abs ( nextItem . Position . m_offset - startOffsetA_ ) *
34783486 BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR ;
34793487
3480- nextItem . ComparisonValue +=
3481- nextOffset * nextSegment . m_averageLength / ( nextSpeed * maxLength_ ) ;
3482- nextItem . Duration += nextOffset * nextSegment . m_averageLength / nextSpeed ;
3488+ currentComparisonValue += nextOffset * nextSegment . m_averageLength / ( nextSpeed * maxLength_ ) ;
3489+ currentDuration += nextOffset * nextSegment . m_averageLength / nextSpeed ;
34833490 }
34843491
34853492 if ( nextLaneId == startLaneB_ ) {
@@ -3511,11 +3518,12 @@ private void ProcessItemPedBicycle(
35113518 float nextOffset = Mathf . Abs ( nextItem . Position . m_offset - startOffsetB_ ) *
35123519 BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR ;
35133520
3514- nextItem . ComparisonValue +=
3515- nextOffset * nextSegment . m_averageLength / ( nextSpeed * maxLength_ ) ;
3516- nextItem . Duration += nextOffset * nextSegment . m_averageLength / nextSpeed ;
3521+ currentComparisonValue += nextOffset * nextSegment . m_averageLength / ( nextSpeed * maxLength_ ) ;
3522+ currentDuration += nextOffset * nextSegment . m_averageLength / nextSpeed ;
35173523 }
35183524
3525+ nextItem . ComparisonValue = comparisonValue + currentComparisonValue ;
3526+ nextItem . Duration = duration + currentDuration ;
35193527 nextItem . LaneId = nextLaneId ;
35203528 nextItem . LanesUsed = item . LanesUsed | nextLaneInfo . m_laneType ;
35213529 nextItem . VehiclesUsed = item . VehiclesUsed | nextLaneInfo . m_vehicleType ;
0 commit comments