summaryrefslogtreecommitdiff
path: root/src/newgrf_commons.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-01-31 17:46:08 +0000
committerfrosch <frosch@openttd.org>2008-01-31 17:46:08 +0000
commitfe9891c8ec0376a3a79195ee2bd76bba317865a5 (patch)
tree938c7be67dc7eb597b5484394eaaf2db1f9b663a /src/newgrf_commons.cpp
parentef35cefddc94539174c490e4e0bbe04a5a9d3dc8 (diff)
downloadopenttd-fe9891c8ec0376a3a79195ee2bd76bba317865a5.tar.xz
(svn r12028) -Codechange: Split common part of station var 0x67, house var 0x62, indtile var 0x60 and industry var 0x62 to 'newgrf_commons.cpp'.
Diffstat (limited to 'src/newgrf_commons.cpp')
-rw-r--r--src/newgrf_commons.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp
index 944161a0a..d10b45138 100644
--- a/src/newgrf_commons.cpp
+++ b/src/newgrf_commons.cpp
@@ -285,3 +285,19 @@ TileIndex GetNearbyTile(byte parameter, TileIndex tile)
/* Make sure we never roam outside of the map */
return TILE_MASK(tile + TileDiffXY(x, y));
}
+
+/**
+ * Common part of station var 0x67 , house var 0x62, indtile var 0x60, industry var 0x62.
+ *
+ * @param tile the tile of interest.
+ * @return 0czzbbss: c = TileType; zz = TileZ; bb: 7-3 zero, 4-2 TerrainType, 1 water/shore, 0 zero; ss = TileSlope
+ */
+uint32 GetNearbyTileInformation(TileIndex tile)
+{
+ TileType tile_type = GetTileType(tile);
+
+ uint z;
+ Slope tileh = GetTileSlope(tile, &z);
+ byte terrain_type = GetTerrainType(tile) << 2 | (tile_type == MP_WATER ? 1 : 0) << 1;
+ return tile_type << 24 | z << 16 | terrain_type << 8 | tileh;
+}