FS#3003 - Don't give bogus cache error for path reservations

Attached to Project: OpenTTD
Opened by Swallow (Swallow) - Sunday, 28 June 2009, 20:41 GMT
Last edited by Remko Bijker (Rubidium) - Saturday, 19 December 2009, 15:43 GMT
Type Feature Request
Category Vehicles → PBS
Status Assigned
Assigned To Michael Lutz (michi_cc)
Operating System All
Severity Very Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No



In the YAPF (rail) function PfCalcCost, it seems to me that reserved tracks aren't masked out when required. For most pathfinders this makes no difference, but it does when finding a safe tile.
I think that changing line 443 of yapf_costrail.hpp to:
if (!tf_local.Follow(cur.tile, || !tf_local.MaskReservedTracks()) {
would solve the issue.

Upon request, I could setup a test savegame.

I do not know whether this causes any problems/desyncs, but at least it created 'CACHE ERROR' messages in my console.
This task depends upon

Comment by Michael Lutz (michi_cc) - Sunday, 28 June 2009, 22:15 GMT
Whatever the problem is, that can't be the proper solution because it would
essentially declare a [free track] - [reserved track] situation as DEAD_END and
SAFE_TILE, which it definitely is not.

So, yes, a test savegame is very much of interest here.
Comment by Remko Bijker (Rubidium) - Sunday, 28 June 2009, 22:55 GMT
Yes, YAPF cache errors are a possible cause for desyncs.
Comment by Swallow (Swallow) - Monday, 29 June 2009, 16:39 GMT
See attached file, created with r16691. Train 2 is trying to reserve a path through train 1's reservation, which succeeds
while pathfinding but fails when trying to reserve, causing CACHE ERROR messages when DEBUG_YAPF_CACHE is set to 1.
Comment by Michael Lutz (michi_cc) - Saturday, 04 July 2009, 12:16 GMT
The 'CACHE ERROR' itself is just a cosmetic problem caused by the failure to
actually reserve the found path. As both pathfinder rounds do find the same path,
this is not a desync-situation though.

I'll see if I can do something to improve the situation.
Comment by Charles Pigott (LordAro) - Friday, 18 August 2017, 22:44 GMT
Doesn't seem to be any warnings any more in current trunk (r27893), but the failure to reserve the found path is still there, i.e. train 2 is still blocked from moving

(currently yapf_costrail.hpp:496)