Tile callback function for rendering a road tile to the screen */
| 1704 | |
| 1705 | /** Tile callback function for rendering a road tile to the screen */ |
| 1706 | static void DrawTile_Road(TileInfo *ti) |
| 1707 | { |
| 1708 | BridgePillarFlags blocked_pillars{}; |
| 1709 | switch (GetRoadTileType(ti->tile)) { |
| 1710 | case RoadTileType::Normal: |
| 1711 | DrawRoadBits(ti); |
| 1712 | |
| 1713 | if (IsBridgeAbove(ti->tile)) { |
| 1714 | RoadBits bits = GetAllRoadBits(ti->tile); |
| 1715 | if ((bits & ROAD_NE) != 0) blocked_pillars.Set(BridgePillarFlag::EdgeNE); |
| 1716 | if ((bits & ROAD_SE) != 0) blocked_pillars.Set(BridgePillarFlag::EdgeSE); |
| 1717 | if ((bits & ROAD_SW) != 0) blocked_pillars.Set(BridgePillarFlag::EdgeSW); |
| 1718 | if ((bits & ROAD_NW) != 0) blocked_pillars.Set(BridgePillarFlag::EdgeNW); |
| 1719 | } |
| 1720 | break; |
| 1721 | |
| 1722 | case RoadTileType::Crossing: { |
| 1723 | if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED); |
| 1724 | |
| 1725 | Axis axis = GetCrossingRailAxis(ti->tile); |
| 1726 | |
| 1727 | const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile)); |
| 1728 | |
| 1729 | RoadType road_rt = GetRoadTypeRoad(ti->tile); |
| 1730 | RoadType tram_rt = GetRoadTypeTram(ti->tile); |
| 1731 | const RoadTypeInfo *road_rti = road_rt == INVALID_ROADTYPE ? nullptr : GetRoadTypeInfo(road_rt); |
| 1732 | const RoadTypeInfo *tram_rti = tram_rt == INVALID_ROADTYPE ? nullptr : GetRoadTypeInfo(tram_rt); |
| 1733 | |
| 1734 | PaletteID pal = PAL_NONE; |
| 1735 | |
| 1736 | /* Draw base ground */ |
| 1737 | if (rti->UsesOverlay()) { |
| 1738 | SpriteID image = SPR_ROAD_Y + axis; |
| 1739 | |
| 1740 | Roadside roadside = GetRoadside(ti->tile); |
| 1741 | if (DrawRoadAsSnowOrDesert(IsOnSnowOrDesert(ti->tile), roadside)) { |
| 1742 | image += 19; |
| 1743 | } else { |
| 1744 | switch (roadside) { |
| 1745 | case Roadside::Barren: |
| 1746 | pal = PALETTE_TO_BARE_LAND; |
| 1747 | break; |
| 1748 | |
| 1749 | case Roadside::Grass: |
| 1750 | break; |
| 1751 | |
| 1752 | default: |
| 1753 | image -= 19; |
| 1754 | break; // Paved |
| 1755 | } |
| 1756 | } |
| 1757 | |
| 1758 | DrawGroundSprite(image, pal); |
| 1759 | } else { |
| 1760 | SpriteID image = rti->base_sprites.crossing + axis; |
| 1761 | if (IsCrossingBarred(ti->tile)) image += 2; |
| 1762 | |
| 1763 | Roadside roadside = GetRoadside(ti->tile); |
nothing calls this directly
no test coverage detected