You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multistop bus/truck stops are not working correctly when using NPF. Note, multistop always uses NPF (regardless of the NPF setting) if YAPF for road vehicles is off.
In the function RoadFindPathToStop in roadveh_cmd.c, the variable 'dist' is declared twice. Firstly (correctly) at the beginning of the function and secondly (incorrectly) in the body of the 'else' statement.
The else statement is used when finding a path using NPF. The return value for 'dist' is assigned in this 'else' block, but this 'dist' goes out of scope and the actual value returned is the 'dist' declared at the beginning of the function. As this is initialised as UINT_MAX, this is the value that is always returned by the function if using NPF, indicating "stop not reachable".
This is the code for the function from the trunk at r4593:
static uint RoadFindPathToStop(const Vehicle *v, TileIndex tile)
{
uint dist = UINT_MAX;
if (_patches.yapf.road_use_yapf) {
// use YAPF
dist = YapfRoadVehDistanceToTile(v, tile);
} else {
// use NPF
NPFFindStationOrTileData fstd;
byte trackdir = GetVehicleTrackdir(v);
uint dist = UINT_MAX; //# # # THIS LINE SHOULD BE REMOVED! # # #
assert(trackdir != 0xFF);
mart3p opened the ticket and wrote:
Reported version: trunk
Operating system: All
This issue was imported from FlySpray: https://bugs.openttd.org/task/242
The text was updated successfully, but these errors were encountered: