Skip to content

Commit

Permalink
Fix OpenTTD#8594: [NRT] Road pathfinder did not account for roadtype …
Browse files Browse the repository at this point in the history
…speed limits
  • Loading branch information
LordAro committed Feb 13, 2021
1 parent 8121706 commit 572b549
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pathfinder/follow_track.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ struct CFollowTrackT
uint16 rail_speed = GetRailTypeInfo(GetRailType(m_old_tile))->max_speed;
if (rail_speed > 0) max_speed = std::min<int>(max_speed, rail_speed);
}
if (IsRoadTT()) {
uint16 road_speed = GetRoadTypeInfo(GetRoadType(m_old_tile, GetRoadTramType(RoadVehicle::From(m_veh)->roadtype)))->max_speed;
if (road_speed > 0) max_speed = std::min<int>(max_speed, road_speed);
}

/* if min speed was requested, return it */
if (pmin_speed != nullptr) *pmin_speed = min_speed;
Expand Down

0 comments on commit 572b549

Please sign in to comment.