road_map.h
changeset 3146 36523d434783
parent 3145 349b745dfbf4
child 3150 025fe8cd7104
equal deleted inserted replaced
3145:349b745dfbf4 3146:36523d434783
    19 
    19 
    20 static inline RoadBits ComplementRoadBits(RoadBits r)
    20 static inline RoadBits ComplementRoadBits(RoadBits r)
    21 {
    21 {
    22 	return ROAD_ALL ^ r;
    22 	return ROAD_ALL ^ r;
    23 }
    23 }
       
    24 
       
    25 static inline RoadBits DiagDirToRoadBits(DiagDirection d)
       
    26 {
       
    27 	return 1 << (3 ^ d);
       
    28 }
       
    29 
    24 
    30 
    25 static inline RoadBits GetRoadBits(TileIndex tile)
    31 static inline RoadBits GetRoadBits(TileIndex tile)
    26 {
    32 {
    27 	return GB(_m[tile].m5, 0, 4);
    33 	return GB(_m[tile].m5, 0, 4);
    28 }
    34 }
    46 
    52 
    47 static inline RoadType GetRoadType(TileIndex tile)
    53 static inline RoadType GetRoadType(TileIndex tile)
    48 {
    54 {
    49 	return GB(_m[tile].m5, 4, 4);
    55 	return GB(_m[tile].m5, 4, 4);
    50 }
    56 }
       
    57 
       
    58 
       
    59 /**
       
    60  * Returns the RoadBits on an arbitrary tile
       
    61  * Special behavior:
       
    62  * - road depots: entrance is treated as road piece
       
    63  * - road tunnels: entrance is treated as road piece
       
    64  * - bridge ramps: treated as straight road
       
    65  * - bridge middle parts: bridge itself is ignored
       
    66  */
       
    67 RoadBits GetAnyRoadBits(TileIndex);
    51 
    68 
    52 
    69 
    53 static inline void MakeRoadNormal(TileIndex t, Owner owner, RoadBits bits, uint town)
    70 static inline void MakeRoadNormal(TileIndex t, Owner owner, RoadBits bits, uint town)
    54 {
    71 {
    55 	SetTileType(t, MP_STREET);
    72 	SetTileType(t, MP_STREET);