Skip to content

Commit 5bcd9b4

Browse files
committed
Fixed #206: Buses must prefer compatible lanes
1 parent c57659e commit 5bcd9b4

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

TLM/TLM/Custom/PathFinding/CustomPathFind2.cs

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,26 +1396,37 @@ private void ProcessItemMain(
13961396
Options.advancedAI &&
13971397
prevIsRouted &&
13981398
m_isRoadVehicle &&
1399-
prevIsCarLane &&
1400-
!m_stablePath
1399+
prevIsCarLane
14011400
) {
14021401
enableAdvancedAI = true;
1403-
CalculateAdvancedAiCostFactors(
1402+
if (!m_stablePath) {
1403+
CalculateAdvancedAiCostFactors(
14041404
#if DEBUG
1405-
debug, unitId,
1405+
debug, unitId,
14061406
#endif
1407-
ref item, ref prevSegment, ref prevLane, nextNodeId, ref nextNode, ref segmentSelectionCost, ref laneSelectionCost, ref laneChangingCost
1408-
);
1407+
ref item, ref prevSegment, ref prevLane, nextNodeId, ref nextNode, ref segmentSelectionCost, ref laneSelectionCost, ref laneChangingCost
1408+
);
14091409

14101410
#if DEBUG
1411-
if (debug) {
1412-
Debug(unitId, item, $"ProcessItemMain: vehicle -> vehicle: Custom routing with activated Advanced Vehicle AI: Calculated cost factors\n"
1413-
+ "\t" + $"segmentSelectionCost={segmentSelectionCost}\n"
1414-
+ "\t" + $"laneSelectionCost={laneSelectionCost}\n"
1415-
+ "\t" + $"laneChangingCost={laneChangingCost}"
1416-
);
1417-
}
1411+
if (debug) {
1412+
Debug(unitId, item, $"ProcessItemMain: vehicle -> vehicle: Custom routing with activated Advanced Vehicle AI: Calculated cost factors\n"
1413+
+ "\t" + $"segmentSelectionCost={segmentSelectionCost}\n"
1414+
+ "\t" + $"laneSelectionCost={laneSelectionCost}\n"
1415+
+ "\t" + $"laneChangingCost={laneChangingCost}"
1416+
);
1417+
}
14181418
#endif
1419+
} else {
1420+
#if DEBUG
1421+
if (debug) {
1422+
Debug(unitId, item, $"ProcessItemMain: vehicle -> vehicle: Custom routing with activated Advanced Vehicle AI and stable path: Using default cost factors\n"
1423+
+ "\t" + $"segmentSelectionCost={segmentSelectionCost}\n"
1424+
+ "\t" + $"laneSelectionCost={laneSelectionCost}\n"
1425+
+ "\t" + $"laneChangingCost={laneChangingCost}"
1426+
);
1427+
}
1428+
#endif
1429+
}
14191430
}
14201431
#endif
14211432

0 commit comments

Comments
 (0)