Draw a lock tile. */
| 838 | |
| 839 | /** Draw a lock tile. */ |
| 840 | static void DrawWaterLock(const TileInfo *ti) |
| 841 | { |
| 842 | LockPart part = GetLockPart(ti->tile); |
| 843 | const DrawTileSprites &dts = _lock_display_data[to_underlying(part)][GetLockDirection(ti->tile)]; |
| 844 | |
| 845 | /* Draw ground sprite. */ |
| 846 | SpriteID image = dts.ground.sprite; |
| 847 | |
| 848 | SpriteID water_base = GetCanalSprite(CF_WATERSLOPE, ti->tile); |
| 849 | if (water_base == 0) { |
| 850 | /* Use default sprites. */ |
| 851 | water_base = SPR_CANALS_BASE; |
| 852 | } else if (HasBit(_water_feature[CF_WATERSLOPE].flags, CFF_HAS_FLAT_SPRITE)) { |
| 853 | /* NewGRF supplies a flat sprite as first sprite. */ |
| 854 | if (image == SPR_FLAT_WATER_TILE) { |
| 855 | image = water_base; |
| 856 | } else { |
| 857 | image++; |
| 858 | } |
| 859 | } |
| 860 | |
| 861 | if (image < 5) image += water_base; |
| 862 | DrawGroundSprite(image, PAL_NONE); |
| 863 | |
| 864 | /* Draw structures. */ |
| 865 | uint zoffs = 0; |
| 866 | SpriteID base = GetCanalSprite(CF_LOCKS, ti->tile); |
| 867 | |
| 868 | if (base == 0) { |
| 869 | /* If no custom graphics, use defaults. */ |
| 870 | base = SPR_LOCK_BASE; |
| 871 | uint8_t z_threshold = part == LockPart::Upper ? 8 : 0; |
| 872 | zoffs = ti->z > z_threshold ? 24 : 0; |
| 873 | } |
| 874 | |
| 875 | DrawWaterTileStruct(ti, dts.GetSequence(), base, zoffs, PAL_NONE, CF_LOCKS); |
| 876 | } |
| 877 | |
| 878 | /** Draw a ship depot tile. */ |
| 879 | static void DrawWaterDepot(const TileInfo *ti) |
no test coverage detected