bridge_map.h
changeset 3234 a2791a480b71
parent 3231 b85d451b6bf8
child 3355 e414a0b104a6
equal deleted inserted replaced
3233:9e09534dcac1 3234:a2791a480b71
     5 
     5 
     6 #include "direction.h"
     6 #include "direction.h"
     7 #include "macros.h"
     7 #include "macros.h"
     8 #include "map.h"
     8 #include "map.h"
     9 #include "rail.h"
     9 #include "rail.h"
       
    10 #include "road_map.h"
    10 #include "tile.h"
    11 #include "tile.h"
       
    12 
       
    13 
       
    14 static inline bool IsBridge(TileIndex t)
       
    15 {
       
    16 	return HASBIT(_m[t].m5, 7);
       
    17 }
       
    18 
       
    19 static inline bool IsBridgeTile(TileIndex t)
       
    20 {
       
    21 	return IsTileType(t, MP_TUNNELBRIDGE) && IsBridge(t);
       
    22 }
    11 
    23 
    12 
    24 
    13 static inline bool IsBridgeRamp(TileIndex t)
    25 static inline bool IsBridgeRamp(TileIndex t)
    14 {
    26 {
    15 	return !HASBIT(_m[t].m5, 6);
    27 	return !HASBIT(_m[t].m5, 6);
    59 {
    71 {
    60 	return (Axis)GB(_m[t].m5, 0, 1);
    72 	return (Axis)GB(_m[t].m5, 0, 1);
    61 }
    73 }
    62 
    74 
    63 
    75 
       
    76 static inline TransportType GetBridgeTransportType(TileIndex t)
       
    77 {
       
    78 	return (TransportType)GB(_m[t].m5, 1, 2);
       
    79 }
       
    80 
       
    81 
    64 static inline bool IsClearUnderBridge(TileIndex t)
    82 static inline bool IsClearUnderBridge(TileIndex t)
    65 {
    83 {
    66 	return GB(_m[t].m5, 3, 3) == 0;
    84 	return GB(_m[t].m5, 3, 3) == 0;
    67 }
    85 }
    68 
    86 
    78 }
    96 }
    79 
    97 
    80 static inline TransportType GetTransportTypeUnderBridge(TileIndex t)
    98 static inline TransportType GetTransportTypeUnderBridge(TileIndex t)
    81 {
    99 {
    82 	return (TransportType)GB(_m[t].m5, 3, 2);
   100 	return (TransportType)GB(_m[t].m5, 3, 2);
       
   101 }
       
   102 
       
   103 static inline RoadBits GetRoadBitsUnderBridge(TileIndex t)
       
   104 {
       
   105 	return GetBridgeAxis(t) == AXIS_X ? ROAD_Y : ROAD_X;
       
   106 }
       
   107 
       
   108 static inline TrackBits GetRailBitsUnderBridge(TileIndex t)
       
   109 {
       
   110 	return GetBridgeAxis(t) == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X;
    83 }
   111 }
    84 
   112 
    85 
   113 
    86 /**
   114 /**
    87  * Finds the end of a bridge in the specified direction starting at a middle tile
   115  * Finds the end of a bridge in the specified direction starting at a middle tile