summaryrefslogtreecommitdiff
path: root/src/newgrf_commons.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newgrf_commons.cpp')
-rw-r--r--src/newgrf_commons.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp
index af7cbda9f..227b9fe9d 100644
--- a/src/newgrf_commons.cpp
+++ b/src/newgrf_commons.cpp
@@ -13,6 +13,7 @@
#include "newgrf.h"
#include "newgrf_commons.h"
#include "tile_map.h"
+#include "station_map.h"
/** Constructor of generic class
* @param offset end of original data for this entity. i.e: houses = 110
@@ -277,6 +278,9 @@ TileIndex GetNearbyTile(byte parameter, TileIndex tile)
if (x >= 8) x -= 16;
if (y >= 8) y -= 16;
+ /* Swap width and height depending on axis for railway stations */
+ if (IsRailwayStationTile(tile) && GetRailStationAxis(tile) == AXIS_X) Swap(x, y);
+
/* Make sure we never roam outside of the map */
return TILE_MASK(tile + TileDiffXY(x, y));
}