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.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp
index 5291bbac9..9e796aa60 100644
--- a/src/newgrf_commons.cpp
+++ b/src/newgrf_commons.cpp
@@ -165,3 +165,13 @@ uint32 GetTerrainType(TileIndex tile)
}
}
+TileIndex GetNearbyTile(byte parameter, TileIndex tile)
+{
+ int8 x = GB(parameter, 0, 4);
+ int8 y = GB(parameter, 4, 4);
+
+ if (x >= 8) x -= 16;
+ if (y >= 8) y -= 16;
+
+ return tile + TileDiffXY(x, y);
+}