* Draws autorail highlights. * * @param *ti TileInfo Tile that is being drawn * @param autorail_type Offset into _AutorailTilehSprite[][] */
| 972 | * @param autorail_type Offset into _AutorailTilehSprite[][] |
| 973 | */ |
| 974 | static void DrawAutorailSelection(const TileInfo *ti, uint autorail_type) |
| 975 | { |
| 976 | SpriteID image; |
| 977 | PaletteID pal; |
| 978 | int offset; |
| 979 | |
| 980 | FoundationPart foundation_part = FOUNDATION_PART_NORMAL; |
| 981 | Slope autorail_tileh = RemoveHalftileSlope(ti->tileh); |
| 982 | if (IsHalftileSlope(ti->tileh)) { |
| 983 | static const uint _lower_rail[4] = { 5U, 2U, 4U, 3U }; |
| 984 | Corner halftile_corner = GetHalftileSlopeCorner(ti->tileh); |
| 985 | if (autorail_type != _lower_rail[halftile_corner]) { |
| 986 | foundation_part = FOUNDATION_PART_HALFTILE; |
| 987 | /* Here we draw the highlights of the "three-corners-raised"-slope. That looks ok to me. */ |
| 988 | autorail_tileh = SlopeWithThreeCornersRaised(OppositeCorner(halftile_corner)); |
| 989 | } |
| 990 | } |
| 991 | |
| 992 | offset = _AutorailTilehSprite[autorail_tileh][autorail_type]; |
| 993 | if (offset >= 0) { |
| 994 | image = SPR_AUTORAIL_BASE + offset; |
| 995 | pal = PAL_NONE; |
| 996 | } else { |
| 997 | image = SPR_AUTORAIL_BASE - offset; |
| 998 | pal = PALETTE_SEL_TILE_RED; |
| 999 | } |
| 1000 | |
| 1001 | DrawSelectionSprite(image, _thd.make_square_red ? PALETTE_SEL_TILE_RED : pal, ti, 7, foundation_part); |
| 1002 | } |
| 1003 | |
| 1004 | enum TileHighlightType : uint8_t { |
| 1005 | THT_NONE, |
no test coverage detected