FS#6476 - Suggested changes for pathfinding for automatic servicing
|
DetailsI saw several things in YAPF and NPF that in my opinion can be improved:
1) Using a FindDepotData struct in YAPF makes code more readable. 2) NPF doesn't use the max_distance provided when looking for a RAIL OR ROAD depot for automatic servicing. The code included the option of using it, but the pathfinder didn't get the value of the max_distance to look ahead. 3) YAPF doesn't use the max_distance provided when looking for a ROAD depot for automatic servicing. See attached patches. |
This task depends upon

The first patch seems to impact trains finding depots. Ran a quick test with a savegame and found that the results (and therefore vehicleenterdepot() calls eventually) are different. Reading the patch, I can't immediately see why...

Okay, seems to be an existing bug. Despite setting max_penalty the pathfinder can still return a tile that is beyond the limit. Because currently the find depot code ignores the actual distance and uses a fake value, the fact that the destination is out of range is ignored.

First part has been added. I found 2 other bugs due to it...