FS#2241 - block for oilfields ( and other airports not removed by autoclean) not removed

Attached to Project: OpenTTD
Opened by Yorick (yorick) - Wednesday, 20 August 2008, 16:17 GMT
Last edited by Remko Bijker (Rubidium) - Sunday, 14 September 2008, 16:49 GMT
Type Bug
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity High
Priority Normal
Reported Version trunk
Due in Version 0.6.3
Due Date Undecided
Percent Complete 100%
Votes 1
  • Yorick (yorick) (2008-09-12)
Private No


When autoclean happens while a plane is loading on an oilrig(or other airport for that matter), the waiting planes keep waiting, and don't land.

First save is test setup, reset company 2 > second save

Please fix this bug for other types of airport too, as it causes a deadlock quite often.
This task depends upon

Closed by  Remko Bijker (Rubidium)
Sunday, 14 September 2008, 16:49 GMT
Reason for closing:  Fixed
Additional comments about closing:  In r14324.
Comment by Gabor Heja (kakaopor) - Thursday, 11 September 2008, 04:22 GMT
It looks like the oilrig's airport_flags was not reset when it was being used by an aircraft of the autocleaned user.

Here is a patch what fixes this problem in autoclean, and after a load too (so the stucked saved games should be ok now).

As far as i know it's working well, but please test it and leave a comment.

(for r14286)
Comment by Yorick (yorick) - Thursday, 11 September 2008, 13:47 GMT
This patch removes all blocks on the airport if there is just one aircraft that's being autocleaned on it.
Comment by Gabor Heja (kakaopor) - Thursday, 11 September 2008, 14:21 GMT
Yes, it removes.

Is there any nobody owned factory with more than one airport? (I haven't seen any so i thought it'll be ok.)
Comment by Yorick (yorick) - Thursday, 11 September 2008, 14:32 GMT
Here is a test save, simply reset company 2 and you'll see the blue plane keeps circling.

If you add some more blue planes which are actually on the airport, if you reset company 2 then, it will remove all blocks instead of the one used by the just cleaned plane
Comment by Gabor Heja (kakaopor) - Thursday, 11 September 2008, 20:42 GMT
This patch cleans up the blocks of aircrafts when DeleteVehicleChain() called.

This can fix the bug only when autocleaning, it cannot "repair" a saved game.

Note: the patch clears the current and the previous blocks of the vehicle (see AirportGoToNextPosition, and AirportClearBlock about handling current and prev. blocks), and because there is not recorded who set the block, _theorically_ deleting the block set by the next vehicle can happen. I think this is a very rare case (i was unable to create such situation), and can only affect graphics, the planes won't crash, and the next block will be successfully set.

Please test it, and leave comments.

Update: the patch can be applied against r14293 too.