Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Vehicle waiting at station affects cargo age rating even if it did not pick up cargo #7430
Version of OpenTTD
master-g21d9e87b4, but affects any version for about 12 years.
Cargo age rating should be affected only if cargo is picked up.
A vehicle waiting at a station will reset the time since pickup despite not actually loading.
Steps to reproduce
This can be seen more clearly by setting a long timetable wait time for the vehicle, so that it is still waiting long after it is full. This also happens if a very long train enters a very short station, so that the vehicle will be delayed a long time.
I believe the issue is caused by 8ef0cbb which resets the days_since_pickup (renamed since to time_since_pickup) for a cargo regardless of whether the cargo was picked up or not.
Possibly if the algorithm is fixed there's some kind of chicken & egg situation with station rating and therefore cargo loading. However, this is so old it may not be applicable any more. I haven't had much chance to look further into it.
A possible solution may be to revert the change (unknown side affects, but seems most correct) or perhaps only reset the timer once per station visit instead of every possible loading loop.
This was buried away on the forums for over a year, but it seems people knew about it but didn't consider reporting an actual bug.
#1143 seems to describe pretty well why it was changed.
I made a possible fix below which only resets time_since_pickup iff "the vehicle has capacity for it".
Another option could be to only trigger the reset when a train begins to load, not during the process
That is a good point. Cheese will still provide a temporary boost. And there would be other ways to cheese, but at a certain point just playing as intended is easier.
Small side note, the title of this issue should probably be changed to something like "Vehicle waiting at station affects cargo pickup time rating even if it did not pick up cargo" since "cargo age" is a different unrelated thing afaik