FS#5685 - AI: wagons are lost in depot because of lack of API feature

Attached to Project: OpenTTD
Opened by pagnon stephane (krinn) - Tuesday, 30 July 2013, 21:19 GMT
Last edited by andythenorth (andythenorth) - Friday, 01 September 2017, 08:29 GMT
Type Feature Request
Category Script
Status New
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version Version?
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


There's simply no feature to get a vehicle that isn't made of a train engine.

Every tricks i tried fail :
- AIVehicleList_Depot : list only vehicle with orders for the depot, and of course wagons have no orders
- AIVehicleList_DefaultGroup : they aren't in the list
- AIVehicleList : they aren't in the list

Out of all functions i tried, none answer a valid vehicle ID and just all list as just empty.

You can handle that in the game by taking great care this never happen (that you loose the vehicle ID of the newly create wagon), else you're dead.

But there a race condition you cannot avoid : create wagon if user save before you attach it to an engine or before you sell it : you're dead, on next loading you don't have the vehicleID and it's now impossible to get it.

Results :
- wagons stays in the depot and you don't know it
- there's no way you could remove the depot, as wagons are in it.
- depot cannot be switch to another rail type depot.
- And of course, plenty weirdness as the AI is getting mad trying to figure out what's going on there :)
This task depends upon