tunnel_map.h
Go to the documentation of this file.00001
00002
00005 #ifndef TUNNEL_MAP_H
00006 #define TUNNEL_MAP_H
00007
00008 #include "direction_func.h"
00009 #include "rail_type.h"
00010 #include "road_type.h"
00011 #include "tile_map.h"
00012
00013
00020 static inline bool IsTunnel(TileIndex t)
00021 {
00022 assert(IsTileType(t, MP_TUNNELBRIDGE));
00023 return !HasBit(_m[t].m5, 7);
00024 }
00025
00031 static inline bool IsTunnelTile(TileIndex t)
00032 {
00033 return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
00034 }
00035
00036 TileIndex GetOtherTunnelEnd(TileIndex);
00037 bool IsTunnelInWay(TileIndex, uint z);
00038 bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir);
00039
00047 static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d, RoadTypes r)
00048 {
00049 SetTileType(t, MP_TUNNELBRIDGE);
00050 SetTileOwner(t, o);
00051 _m[t].m2 = 0;
00052 _m[t].m3 = r;
00053 _m[t].m4 = 0;
00054 _m[t].m5 = TRANSPORT_ROAD << 2 | d;
00055 }
00056
00064 static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r)
00065 {
00066 SetTileType(t, MP_TUNNELBRIDGE);
00067 SetTileOwner(t, o);
00068 _m[t].m2 = 0;
00069 _m[t].m3 = r;
00070 _m[t].m4 = 0;
00071 _m[t].m5 = TRANSPORT_RAIL << 2 | d;
00072 }
00073
00074 #endif