FS#2521 - Provide more consist information with var 45
Attached to Project:
OpenTTD
Opened by George (George) - Saturday, 10 January 2009, 13:19 GMT
Last edited by Michael Lutz (michi_cc) - Tuesday, 04 October 2011, 21:37 GMT
Opened by George (George) - Saturday, 10 January 2009, 13:19 GMT
Last edited by Michael Lutz (michi_cc) - Tuesday, 04 October 2011, 21:37 GMT
|
DetailsR14922
Wiki says: Curvature info (var 45) Format: xxxTxBxF This returns the amount of curvature between the adjacent wagon pairs. It is useful for train vehicles that normally tilt in curves. The curvature is the difference in direction between the surrounding vehicles: F = for the front pair (previous wagon to current wagon, 0 if vehicle is first) B = for the back pair (current wagon to next wagon, 0 if wagon is last) T = for the triplet (previous wagon to next wagon; is zero in an S-bend) Possible values ... I would like to ask to give more information Format: xttTbBfF tt,b,f returns the amount of dH between the adjacent wagon pairs. The dH is the difference in height between the surrounding vehicles: F = for the front pair (previous wagon to current wagon, 0 if vehicle is first) B = for the back pair (current wagon to next wagon, 0 if wagon is last) T = for the triplet (previous wagon to next wagon) Possible values: Decimal Hex Meaning -8 [F]8 -8 (T only) -7 [F]9 -7 (T only) -6 [F]A -6 (T only) -5 [F]B -5 (T only) -4 [F]C -4 -3 [F]D -3 -2 [F]E -2 -1 [F]F -1 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 (T only) 6 6 6 (T only) 7 7 7 (T only) 8 8 8 (T only) |
This task depends upon
Closed by Michael Lutz (michi_cc)
Tuesday, 04 October 2011, 21:37 GMT
Reason for closing: Implemented
Additional comments about closing: In r22997 and r22998.
Tuesday, 04 October 2011, 21:37 GMT
Reason for closing: Implemented
Additional comments about closing: In r22997 and r22998.
I guess I know what you are trying to archieve, but this variable would only help as long as you have only 2 or 3 articulated parts.
So I suggest you a different option:
Variable 9E specifies the z position of a vehicle. By reading that variable for the active vehicle and for the front (i.e. related) vehicle you can calculate a height difference to the front vehicle.
Also when you are going to add that many sprites you might reconsider https://www.tt-forums.net/viewtopic.php?p=662609#p662609
Btw. var 9F speficies the current orientation (0-7) of the vehicle.
Unfortunately some RVs are very long - dolphin bus would be 6 parts long. I need information about dH between 3 parts in a row
Parameter to the vars is the (signed) position in the chain relative to the current [or front as related object] vehicle. 01 is the next, FF is the previous vehicle.
var 61: DirDifference similar to var 45 (B or F part)
var 62: height difference
var 63: vehicle status (VS_HIDDDEN, VS_STOPPED, etc.) similar to var 80+32
Variable 61 and 62 seem to waste valuable variable slots. So maybe put the difference wrt. direction, x position, y position and z position in 4 signed bytes of one variable. (format: zzyyxxdd)
And maybe also the hidden flag into bit 7 of the direction component or so... (the other vehicle flags do not seem to be useful at all)
xxyyzzhd, where xx, yy and zz (8 bits each) is the (signed) x-difference, d is 4 bits of DirDifference like in var 45, and h is 1 bit of VS_HIDDEN in bit 7 (appropriate mask is \dx00000080)