Allow drive-through road stops to be one-way
This commit is contained in:
@@ -92,7 +92,7 @@ struct CFollowTrackT
|
||||
inline static TransportType TT() { return Ttr_type_; }
|
||||
inline static bool IsWaterTT() { return TT() == TRANSPORT_WATER; }
|
||||
inline static bool IsRailTT() { return TT() == TRANSPORT_RAIL; }
|
||||
inline bool IsTram() { return IsRoadTT() && RoadTypeIsTram(RoadVehicle::From(m_veh)->roadtype); }
|
||||
inline bool IsTram() const { return IsRoadTT() && RoadTypeIsTram(RoadVehicle::From(m_veh)->roadtype); }
|
||||
inline static bool IsRoadTT() { return TT() == TRANSPORT_ROAD; }
|
||||
inline static bool Allow90degTurns() { return T90deg_turns_allowed_; }
|
||||
inline static bool DoTrackMasking() { return Tmask_reserved_tracks; }
|
||||
|
@@ -369,7 +369,11 @@ static int32 NPFRoadPathCost(AyStar *as, AyStarNode *current, OpenListNode *pare
|
||||
/* 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() * _settings_game.pf.npf.npf_road_dt_occupied_penalty / entry->GetLength();
|
||||
if (GetDriveThroughStopDisallowedRoadDirections(tile) != DRD_NONE) {
|
||||
cost += (entry->GetOccupied() + rs->GetEntry(ReverseDiagDir(dir))->GetOccupied()) * _settings_game.pf.npf.npf_road_dt_occupied_penalty / (2 * entry->GetLength());
|
||||
} else {
|
||||
cost += entry->GetOccupied() * _settings_game.pf.npf.npf_road_dt_occupied_penalty / entry->GetLength();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Increase cost for filled road stops */
|
||||
|
@@ -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