tunnel_map.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef TUNNEL_MAP_H
00013 #define TUNNEL_MAP_H
00014
00015 #include "road_map.h"
00016
00017
00024 static inline bool IsTunnel(TileIndex t)
00025 {
00026 assert(IsTileType(t, MP_TUNNELBRIDGE));
00027 return !HasBit(_m[t].m5, 7);
00028 }
00029
00035 static inline bool IsTunnelTile(TileIndex t)
00036 {
00037 return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
00038 }
00039
00040 TileIndex GetOtherTunnelEnd(TileIndex);
00041 bool IsTunnelInWay(TileIndex, uint z);
00042 bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir);
00043
00051 static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d, RoadTypes r)
00052 {
00053 SetTileType(t, MP_TUNNELBRIDGE);
00054 SetTileOwner(t, o);
00055 _m[t].m2 = 0;
00056 _m[t].m3 = 0;
00057 _m[t].m4 = 0;
00058 _m[t].m5 = TRANSPORT_ROAD << 2 | d;
00059 SB(_m[t].m6, 2, 4, 0);
00060 _me[t].m7 = 0;
00061 SetRoadOwner(t, ROADTYPE_ROAD, o);
00062 if (o != OWNER_TOWN) SetRoadOwner(t, ROADTYPE_TRAM, o);
00063 SetRoadTypes(t, r);
00064 }
00065
00073 static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r)
00074 {
00075 SetTileType(t, MP_TUNNELBRIDGE);
00076 SetTileOwner(t, o);
00077 _m[t].m2 = 0;
00078 _m[t].m3 = r;
00079 _m[t].m4 = 0;
00080 _m[t].m5 = TRANSPORT_RAIL << 2 | d;
00081 SB(_m[t].m6, 2, 4, 0);
00082 _me[t].m7 = 0;
00083 }
00084
00085 #endif