You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a problem with variational action 2 var. 68 for stations. The attached test grf and the screenshot of its use in both TTDPatch and OpenTTD, demonstrate the problem. The screenshot was taken from 0.6.0-beta3 but I also tested with r11838 and it is the same.
The test grf is intended to display a red line on the edge of a platform if there is another platform alongside. This should end up with a pair of red lines between adjacent platforms. As the screenshot shows, this works correctly in TTDPatch but fails in OpenTTD.
The problem seems to be that the x and y components of the tile offset (the parameter for var. 68) are reversed. The grf spec. says "The high nibble contains the amount to move sideways (between platforms), the low one is the amount to move along the platform. Negative offsets move northwards, positive ones southwards." So, for a platform on the X-axis, this means the high nibble should be the Y offset and the low nibble the X offset.
The code from newgrf_commons.cpp:
TileIndex GetNearbyTile(byte parameter, TileIndex tile)
{
int8 x = GB(parameter, 0, 4);
int8 y = GB(parameter, 4, 4);
...
/* Swap width and height depending on axis for railway stations */
if (IsRailwayStationTile(tile) && GetRailStationAxis(tile) == AXIS_X) Swap(x, y);
...
}
So x is set to the low nibble, y to the high nibble, but then for a station on the X-axis, they are swapped. This swap should occur when the station is on the Y-axis.
It seems this has been incorrect since support for var. 68 for stations was added at r11679.
mart3p opened the ticket and wrote:
Attachments
Reported version: trunk
Operating system: All
This issue was imported from FlySpray: https://bugs.openttd.org/task/1753
The text was updated successfully, but these errors were encountered: