FS#3151 - Allow access to adjacent vehicleIDs in consist / position relative to engines

Attached to Project: OpenTTD
Opened by Ingo von Borstel (planetmaker) - Thursday, 27 August 2009, 05:08 GMT
Last edited by frosch (frosch) - Saturday, 08 December 2012, 01:15 GMT
Type Feature Request
Category Vehicles
Status Closed
Assigned To No-one
Operating System All
Severity Very Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Following the discussion yesterday on IRC: The attached image (prepared by DJNekkid) shows that the graphics for the wagons following the engine in the "double train" consists are unintentionally different from how they are for the 2nd vehicle (1st wagon) in the consist.

There are two solutions so far, to levy this problem:
a) use and allow only one wagonID with refit capability. Then the position in the train wrt engines can be determined unambigeously. But that is then a pain for the player who wants to build a train with all three, mail, passenger and valuable cars.
b) Remove the special graphics which depend on the adjacency to the engine.

Both is IMO not very satisfying.

Thus I propose to implement *some* way to allow assessment of a vehicles position in a consist relative to others and getting information on them.

I've no good proposal for a solution of that now, though :-(
It could either be a new variable, as my simple initial view then would be or seemingly vehicle classes:
[22:11] <planetmaker> hm... seems like I have the choice between "make mixing mail/pax/valuables painful for the player" and "make graphics such that gfx don'd depend upon distance from engine"
[22:12] <Lakie> The only other way would be to implement a system to traverse the consist but I don't think thats a good idea. So basically yeah, pain or simple.
[22:12] <frosch123> the second other way would be to implement vehicle classes, like house classes
[22:13] <planetmaker> uh-oh. Both doesn't sound like a light-weight operation
[22:14] <Lakie> You have a major class and then ids belonging to a class?
[22:15] <frosch123> Lakie: e.g. house var 44
This task depends upon

Closed by  frosch (frosch)
Saturday, 08 December 2012, 01:15 GMT
Reason for closing:  Implemented
Additional comments about closing:  available via var 61 for some time
Comment by Hirundo (Hirundo) - Thursday, 28 October 2010, 08:20 GMT
The equivalent of RandomAction2 type 84 could be implemented for varaction2.
Then, it's possible to access all variables of all vehicles in the chain. Since the offset can be set dynamically via register 0x100, the information of vars 40/41 can be used to access the correct vehicle if needed.

Most of the functionality should be already there in both TTDPatch and OpenTTD, most of the work is agreeing on a specification.