diff options
author | belugas <belugas@openttd.org> | 2007-06-08 17:54:18 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2007-06-08 17:54:18 +0000 |
commit | e8c6d571508fbb49636b7fc1b70b58813d2caaa3 (patch) | |
tree | cd5fc9ecbc88d18cd0dec7eeae1bc0713a76e991 /src/newgrf_commons.cpp | |
parent | 6983d0b547ce9248a658ffa5d6c76c860d08a72e (diff) | |
download | openttd-e8c6d571508fbb49636b7fc1b70b58813d2caaa3.tar.xz |
(svn r10066) -Codechange: Expose function GetNearbyTile by moving it to newgrf_commons.[cpp|h]. Will be used by industries in a few.
Diffstat (limited to 'src/newgrf_commons.cpp')
-rw-r--r-- | src/newgrf_commons.cpp | 10 |
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); +} |