diff options
author | tron <tron@openttd.org> | 2006-03-06 20:55:24 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-06 20:55:24 +0000 |
commit | f2dc736554c06d69dd936131c4a09ddbc6b58083 (patch) | |
tree | 14ef1d7e7e885dff603aa06189b416a7bd2a6ae0 /tunnel_map.h | |
parent | 2d3c28f2b3d24c2b01e54a51e2dcf5ad7f4851c8 (diff) | |
download | openttd-f2dc736554c06d69dd936131c4a09ddbc6b58083.tar.xz |
(svn r3777) Add some functions to handle tunnels
Diffstat (limited to 'tunnel_map.h')
-rw-r--r-- | tunnel_map.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tunnel_map.h b/tunnel_map.h new file mode 100644 index 000000000..aa30e12c3 --- /dev/null +++ b/tunnel_map.h @@ -0,0 +1,47 @@ +/* $Id$ */ + +#ifndef TUNNEL_MAP_H +#define TUNNEL_MAP_H + +#include "direction.h" +#include "macros.h" +#include "map.h" +#include "rail.h" + + +static inline DiagDirection GetTunnelDirection(TileIndex t) +{ + return (DiagDirection)GB(_m[t].m5, 0, 2); +} + + +static inline TransportType GetTunnelTransportType(TileIndex t) +{ + return (TransportType)GB(_m[t].m5, 2, 2); +} + + +TileIndex GetOtherTunnelEnd(TileIndex); + + +static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d) +{ + SetTileType(t, MP_TUNNELBRIDGE); + SetTileOwner(t, o); + _m[t].m2 = 0; + _m[t].m3 = 0; + _m[t].m4 = 0; + _m[t].m5 = TRANSPORT_ROAD << 2 | d; +} + +static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r) +{ + SetTileType(t, MP_TUNNELBRIDGE); + SetTileOwner(t, o); + _m[t].m2 = 0; + _m[t].m3 = r; + _m[t].m4 = 0; + _m[t].m5 = TRANSPORT_RAIL << 2 | d; +} + +#endif |