Allow drive-through road stops to be one-way
This commit is contained in:
@@ -68,7 +68,7 @@ protected:
|
||||
}
|
||||
|
||||
/** return one tile cost */
|
||||
inline int OneTileCost(TileIndex tile, Trackdir trackdir)
|
||||
inline int OneTileCost(TileIndex tile, Trackdir trackdir, const TrackFollower *tf)
|
||||
{
|
||||
int cost = 0;
|
||||
|
||||
@@ -101,7 +101,11 @@ protected:
|
||||
/* When we're the first road stop in a 'queue' of them we increase
|
||||
* cost based on the fill percentage of the whole queue. */
|
||||
const RoadStop::Entry *entry = rs->GetEntry(dir);
|
||||
cost += entry->GetOccupied() * Yapf().PfGetSettings().road_stop_occupied_penalty / entry->GetLength();
|
||||
if (GetDriveThroughStopDisallowedRoadDirections(tile) != DRD_NONE && !tf->IsTram()) {
|
||||
cost += (entry->GetOccupied() + rs->GetEntry(ReverseDiagDir(dir))->GetOccupied()) * Yapf().PfGetSettings().road_stop_occupied_penalty / (2 * entry->GetLength());
|
||||
} else {
|
||||
cost += entry->GetOccupied() * Yapf().PfGetSettings().road_stop_occupied_penalty / entry->GetLength();
|
||||
}
|
||||
}
|
||||
|
||||
if (predicted_occupied) {
|
||||
@@ -153,7 +157,7 @@ public:
|
||||
|
||||
for (;;) {
|
||||
/* base tile cost depending on distance between edges */
|
||||
segment_cost += Yapf().OneTileCost(tile, trackdir);
|
||||
segment_cost += Yapf().OneTileCost(tile, trackdir, tf);
|
||||
|
||||
const RoadVehicle *v = Yapf().GetVehicle();
|
||||
/* we have reached the vehicle's destination - segment should end here to avoid target skipping */
|
||||
|
Reference in New Issue
Block a user