| 2420 | } |
| 2421 | |
| 2422 | static void DrawTile_Track(TileInfo *ti) |
| 2423 | { |
| 2424 | const RailTypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile)); |
| 2425 | BridgePillarFlags blocked_pillars{}; |
| 2426 | PaletteID pal = GetCompanyPalette(GetTileOwner(ti->tile)); |
| 2427 | |
| 2428 | if (IsPlainRail(ti->tile)) { |
| 2429 | TrackBits rails = GetTrackBits(ti->tile); |
| 2430 | |
| 2431 | DrawTrackBits(ti, rails); |
| 2432 | |
| 2433 | if (HasBit(_display_opt, DO_FULL_DETAIL)) DrawTrackDetails(ti, rti, pal); |
| 2434 | |
| 2435 | if (HasRailCatenaryDrawn(GetRailType(ti->tile))) DrawRailCatenary(ti); |
| 2436 | |
| 2437 | if (HasSignals(ti->tile)) DrawSignals(ti->tile, rails, rti); |
| 2438 | |
| 2439 | if (IsBridgeAbove(ti->tile)) { |
| 2440 | if ((rails & TRACK_BIT_3WAY_NE) != 0) blocked_pillars.Set(BridgePillarFlag::EdgeNE); |
| 2441 | if ((rails & TRACK_BIT_3WAY_SE) != 0) blocked_pillars.Set(BridgePillarFlag::EdgeSE); |
| 2442 | if ((rails & TRACK_BIT_3WAY_SW) != 0) blocked_pillars.Set(BridgePillarFlag::EdgeSW); |
| 2443 | if ((rails & TRACK_BIT_3WAY_NW) != 0) blocked_pillars.Set(BridgePillarFlag::EdgeNW); |
| 2444 | } |
| 2445 | } else { |
| 2446 | /* draw depot */ |
| 2447 | const DrawTileSprites *dts; |
| 2448 | DiagDirection dir = GetRailDepotDirection(ti->tile); |
| 2449 | |
| 2450 | if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED); |
| 2451 | |
| 2452 | if (IsInvisibilitySet(TO_BUILDINGS)) { |
| 2453 | /* Draw rail instead of depot */ |
| 2454 | dts = &_depot_invisible_gfx_table[dir]; |
| 2455 | } else { |
| 2456 | dts = &_depot_gfx_table[dir]; |
| 2457 | } |
| 2458 | |
| 2459 | SpriteID image; |
| 2460 | if (rti->UsesOverlay()) { |
| 2461 | image = SPR_FLAT_GRASS_TILE; |
| 2462 | } else { |
| 2463 | image = dts->ground.sprite; |
| 2464 | if (image != SPR_FLAT_GRASS_TILE) image += rti->GetRailtypeSpriteOffset(); |
| 2465 | } |
| 2466 | |
| 2467 | /* Adjust ground tile for desert and snow. */ |
| 2468 | if (IsSnowRailGround(ti->tile)) { |
| 2469 | if (image != SPR_FLAT_GRASS_TILE) { |
| 2470 | image += rti->snow_offset; // tile with tracks |
| 2471 | } else { |
| 2472 | image = SPR_FLAT_SNOW_DESERT_TILE; // flat ground |
| 2473 | } |
| 2474 | } |
| 2475 | |
| 2476 | DrawGroundSprite(image, GroundSpritePaletteTransform(image, PAL_NONE, pal)); |
| 2477 | |
| 2478 | if (rti->UsesOverlay()) { |
| 2479 | SpriteID ground = GetCustomRailSprite(rti, ti->tile, RTSG_GROUND); |
nothing calls this directly
no test coverage detected