road_map.h
changeset 3900 2c84ed52709d
parent 3793 7fe24e10ea63
child 4000 4009d092b306
equal deleted inserted replaced
3899:5ba7f20a14ca 3900:2c84ed52709d
    16 } RoadTileType;
    16 } RoadTileType;
    17 
    17 
    18 static inline RoadTileType GetRoadTileType(TileIndex t)
    18 static inline RoadTileType GetRoadTileType(TileIndex t)
    19 {
    19 {
    20 	assert(IsTileType(t, MP_STREET));
    20 	assert(IsTileType(t, MP_STREET));
    21 	return GB(_m[t].m5, 4, 4);
    21 	return (RoadTileType)(GB(_m[t].m5, 4, 4));
    22 }
    22 }
    23 
    23 
    24 static inline bool IsLevelCrossing(TileIndex t)
    24 static inline bool IsLevelCrossing(TileIndex t)
    25 {
    25 {
    26 	return GetRoadTileType(t) == ROAD_TILE_CROSSING;
    26 	return GetRoadTileType(t) == ROAD_TILE_CROSSING;
    32 }
    32 }
    33 
    33 
    34 static inline RoadBits GetRoadBits(TileIndex t)
    34 static inline RoadBits GetRoadBits(TileIndex t)
    35 {
    35 {
    36 	assert(GetRoadTileType(t) == ROAD_TILE_NORMAL);
    36 	assert(GetRoadTileType(t) == ROAD_TILE_NORMAL);
    37 	return GB(_m[t].m5, 0, 4);
    37 	return (RoadBits)(GB(_m[t].m5, 0, 4));
    38 }
    38 }
    39 
    39 
    40 static inline void SetRoadBits(TileIndex t, RoadBits r)
    40 static inline void SetRoadBits(TileIndex t, RoadBits r)
    41 {
    41 {
    42 	assert(GetRoadTileType(t) == ROAD_TILE_NORMAL); // XXX incomplete
    42 	assert(GetRoadTileType(t) == ROAD_TILE_NORMAL); // XXX incomplete
   141 
   141 
   142 static inline void StartRoadWorks(TileIndex t)
   142 static inline void StartRoadWorks(TileIndex t)
   143 {
   143 {
   144 	assert(!HasRoadWorks(t));
   144 	assert(!HasRoadWorks(t));
   145 	/* Remove any trees or lamps in case or roadwork */
   145 	/* Remove any trees or lamps in case or roadwork */
   146 	SetGroundType(t, min(GetGroundType(t), RGT_PAVED) + RGT_ROADWORK_OFFSET);
   146 	SetGroundType(t, (RoadGroundType)(min(GetGroundType(t), RGT_PAVED) + RGT_ROADWORK_OFFSET));
   147 }
   147 }
   148 
   148 
   149 static inline void TerminateRoadWorks(TileIndex t)
   149 static inline void TerminateRoadWorks(TileIndex t)
   150 {
   150 {
   151 	assert(HasRoadWorks(t));
   151 	assert(HasRoadWorks(t));
   152 	SetGroundType(t, GetGroundType(t) - RGT_ROADWORK_OFFSET);
   152 	SetGroundType(t, (RoadGroundType)(GetGroundType(t) - RGT_ROADWORK_OFFSET));
   153 	/* Stop the counter */
   153 	/* Stop the counter */
   154 	SB(_m[t].m4, 0, 4, 0);
   154 	SB(_m[t].m4, 0, 4, 0);
   155 }
   155 }
   156 
   156 
   157 static inline bool HasPavement(TileIndex t)
   157 static inline bool HasPavement(TileIndex t)