OpenTTD

Tasklist

FS#6476 - Suggested changes for pathfinding for automatic servicing

Attached to Project: OpenTTD
Opened by Juanjo (juanjo) - Sunday, 05 June 2016, 08:29 GMT
Type Patch
Category Core
Status New
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

I 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

Comment by Peter Nelson (peter1138) - Sunday, 02 April 2017, 23:18 GMT
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...
Comment by Peter Nelson (peter1138) - Monday, 03 April 2017, 06:30 GMT
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.
Comment by Peter Nelson (peter1138) - Monday, 03 April 2017, 22:03 GMT
First part has been added. I found 2 other bugs due to it...

Loading...