OpenTTD

Tasklist

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
Type Feature Request
Category NewGRF
Status Closed
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
  • George (George) (2009-01-11)
Private No

Details

R14922

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.
Comment by George (George) - Sunday, 11 January 2009, 05:17 GMT
Frosch: Of cause using the new var would be also fine
Comment by frosch (frosch) - Sunday, 11 January 2009, 12:47 GMT
I thought a bit about this variable and concluded that it is not very helpful.
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.
Comment by George (George) - Sunday, 11 January 2009, 13:34 GMT
Frosch:
Unfortunately some RVs are very long - dolphin bus would be 6 parts long. I need information about dH between 3 parts in a row
Comment by Johannes E. Krause (Eddi) - Sunday, 04 April 2010, 08:19 GMT
Patch implementing the above (i hope)
Comment by George (George) - Monday, 05 April 2010, 17:46 GMT
if you need a diff testing please provide a win 32 executable
Comment by Johannes E. Krause (Eddi) - Tuesday, 07 December 2010, 15:59 GMT
In a previous discussion on IRC it was brought up that maybe a more flexible approach using 60+ vars would be more appropriate, so i have attempted an implementation.

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
Comment by Jose Soler (Terkhen) - Wednesday, 08 December 2010, 18:14 GMT
You can find a Win32 binary of the patch posted at the previous post here: https://devs.openttd.org/~terkhen/fs_2521/
Comment by frosch (frosch) - Wednesday, 08 December 2010, 19:35 GMT
Though I am not sure about the general usefulness of these variables :), still some comment:

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)
Comment by Johannes E. Krause (Eddi) - Wednesday, 11 May 2011, 18:35 GMT
updated last patch with var 64 in the format according to proposal by frosch:
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)
Comment by Johannes E. Krause (Eddi) - Wednesday, 11 May 2011, 23:29 GMT
next update: var 65 returning the engine-id (like var C6)
Comment by Johannes E. Krause (Eddi) - Tuesday, 19 July 2011, 10:34 GMT
i just noticed that in the original curve_info patch, the line "int bz = (u_p == NULL)" must read "(u_n == NULL)".

Loading...