FS#6514 - Missing documentation for AIVehicle::RefitVehicle

Attached to Project: OpenTTD
Opened by Kogut (Kogut) - Wednesday, 21 September 2016, 11:50 GMT
Last edited by Alberth (Alberth) - Saturday, 19 August 2017, 07:27 GMT
Type Bug
Category Script → NoAI
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version 1.6.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Wagon unattached to engine may not be refitted, even if other preconditions are fullfilled.

Note that wagon in depot, unattached to an engine will not always return false for IsValidVehicle(vehicle_id) (note also AIVehicle.MoveWagon must be able to move newly constructed wagon, so it is tricky whatever lone wagon should return true for IsValidVehicle).

It seems that presence of engine changes whatever lone wagon IsValidVehicle but it is changing whatever lone wagon may be refitted.

I attached also debug AI used to test game behaviour.
This task depends upon

Closed by  Alberth (Alberth)
Saturday, 19 August 2017, 07:27 GMT
Reason for closing:  Requested by user
Additional comments about closing:  Not sure why you request closure, but wish granted
Comment by Kogut (Kogut) - Wednesday, 21 September 2016, 12:05 GMT
It gets better: I am investigating further, but at least in part it is confused by AIVehicle::BuildVehicle problem.

If depot already has unattached wagons AIVehicle::BuildVehicle will return id, but wagon will join other wagons and therefore this id will immediately become invalid.