Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect operation of varaction 2 var.68 for stations #1753

Closed
DorpsGek opened this issue Feb 7, 2008 · 1 comment
Closed

Incorrect operation of varaction 2 var.68 for stations #1753

DorpsGek opened this issue Feb 7, 2008 · 1 comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Feb 7, 2008

mart3p opened the ticket and wrote:

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.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/1753
@DorpsGek
Copy link
Member Author

peter1138 closed the ticket.

Reason for closing: Fixed

Fixed in r12108


This comment was imported from FlySpray: https://bugs.openttd.org/task/1753

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) NewStations labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant