FS#404 - Cargo never delivered to station after bribe and before first pickup

Attached to Project: OpenTTD
Opened by Anonymous Submitter - Thursday, 16 November 2006, 17:21 GMT
Last edited by Patric Stout (TrueBrain) - Thursday, 08 March 2007, 20:16 GMT
Type Bug
Category Core
Status Closed
Assigned To Patric Stout (TrueBrain)
Operating System All
Severity Medium
Priority Normal
Reported Version 0.4.8
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


When i created an coal line between an coal station and powerline i decided i wanted more train station space before starting to run trains on it because the production rate was high and 3 coal mines where in reach.
I bribed an town which was close to it which blocked extending the station but the bribe was discovered by a local investigator.

Then i decided then just run the station this way without extending it.
I have had an train on it for a very long time (enough time that the local government funding options come back, thanks to fast forward) but it never starts to load coal anymore (checked and it is correct train, and there is at least 1 coal mine in reach).

The fix was to destroy the station, bribe town, then build new station AFTER the old name dissapeared and it could load coal again.

I have tested this a few times and the same thing happens only when you build a station and before loading cause an investigation failure with bribes, if you allready have cargo running there it doesn't make a difference.
This task depends upon

Closed by  Patric Stout (TrueBrain)
Thursday, 08 March 2007, 20:50 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in revision 9070
Comment by Darkvater (Darkvater) - Thursday, 07 December 2006, 17:32 GMT
Confirmed (0.4.8, r7422). When a bribe is discovered the rating for all goods a cargo has/can have is reset to 0. If no cargo has been picked up from the station, the rating will never move away from the zero, most probably an issue in UpdateStationRating()
Comment by Darkvater (Darkvater) - Thursday, 07 December 2006, 17:34 GMT
 FS#404 -cargo_not_delivered_bribe.sav << savegame after bribe has been discovered and no vehicle has visited station.
Comment by Patric Stout (TrueBrain) - Thursday, 08 March 2007, 20:13 GMT
The problem is kind of funny:

On bribe-fail the rating is reset to 0
When you didn't had cargo moved to that station, enroute_from is NULL
If enroute_from == NULL, rating isn't increased
If rating is 0, you have 0 chance of getting cargo moved to the station

Ergo: chicken-egg problem. Something has to jump-start this to get it to work.

My advise is to make UpdateStationRating check if enroute_from == NULL, and rating < initial value. If so, slowly (rating++) increase the rating back to his original level. Setting the rating to 1 instead of 0 doesn't help, as then you have an other bug: if you start moving a cargo years after a failed bribe, you still start at rating 1 for no clear reason what so ever. This way makes sure that over time, you can't find a trace of a failed bribe.

Patch here: