tunnel_map.h
changeset 3154 6ab0cb6b7ab3
child 3156 f4caf4197189
equal deleted inserted replaced
3153:e83501906eae 3154:6ab0cb6b7ab3
       
     1 /* $Id$ */
       
     2 
       
     3 #ifndef TUNNEL_MAP_H
       
     4 #define TUNNEL_MAP_H
       
     5 
       
     6 #include "direction.h"
       
     7 #include "macros.h"
       
     8 #include "map.h"
       
     9 #include "rail.h"
       
    10 
       
    11 
       
    12 static inline DiagDirection GetTunnelDirection(TileIndex t)
       
    13 {
       
    14 	return (DiagDirection)GB(_m[t].m5, 0, 2);
       
    15 }
       
    16 
       
    17 
       
    18 static inline TransportType GetTunnelTransportType(TileIndex t)
       
    19 {
       
    20 	return (TransportType)GB(_m[t].m5, 2, 2);
       
    21 }
       
    22 
       
    23 
       
    24 TileIndex GetOtherTunnelEnd(TileIndex);
       
    25 
       
    26 
       
    27 static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d)
       
    28 {
       
    29 	SetTileType(t, MP_TUNNELBRIDGE);
       
    30 	SetTileOwner(t, o);
       
    31 	_m[t].m2 = 0;
       
    32 	_m[t].m3 = 0;
       
    33 	_m[t].m4 = 0;
       
    34 	_m[t].m5 = TRANSPORT_ROAD << 2 | d;
       
    35 }
       
    36 
       
    37 static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r)
       
    38 {
       
    39 	SetTileType(t, MP_TUNNELBRIDGE);
       
    40 	SetTileOwner(t, o);
       
    41 	_m[t].m2 = 0;
       
    42 	_m[t].m3 = r;
       
    43 	_m[t].m4 = 0;
       
    44 	_m[t].m5 = TRANSPORT_RAIL << 2 | d;
       
    45 }
       
    46 
       
    47 #endif