# tunnel_map.h

Go to the documentation of this file.

    00001 /* $Id: tunnel_map.h 12986 2008-05-07 09:07:19Z rubidium $ */
    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 "transport_type.h"
    00012 #include "tile_map.h"
    00013
    00014
    00021 static inline bool IsTunnel(TileIndex t)
    00022 {
    00023   assert(IsTileType(t, MP_TUNNELBRIDGE));
    00024   return !HasBit(_m[t].m5, 7);
    00025 }
    00026
    00032 static inline bool IsTunnelTile(TileIndex t)
    00033 {
    00034   return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
    00035 }
    00036
    00037 TileIndex GetOtherTunnelEnd(TileIndex);
    00038 bool IsTunnelInWay(TileIndex, uint z);
    00039 bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir);
    00040
    00048 static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d, RoadTypes r)
    00049 {
    00050   SetTileType(t, MP_TUNNELBRIDGE);
    00051   SetTileOwner(t, o);
    00052   _m[t].m2 = 0;
    00053   _m[t].m3 = r;
    00054   _m[t].m4 = 0;
    00055   _m[t].m5 = TRANSPORT_ROAD << 2 | d;
    00056 }
    00057
    00065 static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r)
    00066 {
    00067   SetTileType(t, MP_TUNNELBRIDGE);
    00068   SetTileOwner(t, o);
    00069   _m[t].m2 = 0;
    00070   _m[t].m3 = r;
    00071   _m[t].m4 = 0;
    00072   _m[t].m5 = TRANSPORT_RAIL << 2 | d;
    00073 }
    00074
    00075 #endif /* TUNNEL_MAP_H */