* Draw the road depot sprite. * @param x The x offset to draw at. * @param y The y offset to draw at. * @param dir The direction the depot must be facing. * @param rt The road type of the depot to draw. */
| 1899 | * @param rt The road type of the depot to draw. |
| 1900 | */ |
| 1901 | void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt) |
| 1902 | { |
| 1903 | PaletteID palette = GetCompanyPalette(_local_company); |
| 1904 | |
| 1905 | const RoadTypeInfo *rti = GetRoadTypeInfo(rt); |
| 1906 | int relocation = GetCustomRoadSprite(rti, INVALID_TILE, ROTSG_DEPOT); |
| 1907 | bool default_gfx = relocation == 0; |
| 1908 | if (default_gfx) { |
| 1909 | if (rti->flags.Test(RoadTypeFlag::Catenary)) { |
| 1910 | if (_loaded_newgrf_features.tram == TRAMWAY_REPLACE_DEPOT_WITH_TRACK && RoadTypeIsTram(rt) && !rti->UsesOverlay()) { |
| 1911 | /* Sprites with track only work for default tram */ |
| 1912 | relocation = SPR_TRAMWAY_DEPOT_WITH_TRACK - SPR_ROAD_DEPOT; |
| 1913 | default_gfx = false; |
| 1914 | } else { |
| 1915 | /* Sprites without track are always better, if provided */ |
| 1916 | relocation = SPR_TRAMWAY_DEPOT_NO_TRACK - SPR_ROAD_DEPOT; |
| 1917 | } |
| 1918 | } |
| 1919 | } else { |
| 1920 | relocation -= SPR_ROAD_DEPOT; |
| 1921 | } |
| 1922 | |
| 1923 | const DrawTileSprites *dts = &_road_depot[dir]; |
| 1924 | DrawSprite(dts->ground.sprite, PAL_NONE, x, y); |
| 1925 | |
| 1926 | if (default_gfx) { |
| 1927 | uint offset = GetRoadSpriteOffset(SLOPE_FLAT, DiagDirToRoadBits(dir)); |
| 1928 | if (rti->UsesOverlay()) { |
| 1929 | SpriteID ground = GetCustomRoadSprite(rti, INVALID_TILE, ROTSG_OVERLAY); |
| 1930 | if (ground != 0) DrawSprite(ground + offset, PAL_NONE, x, y); |
| 1931 | } else if (RoadTypeIsTram(rt)) { |
| 1932 | DrawSprite(SPR_TRAMWAY_OVERLAY + offset, PAL_NONE, x, y); |
| 1933 | } |
| 1934 | } |
| 1935 | |
| 1936 | DrawRailTileSeqInGUI(x, y, dts, relocation, 0, palette); |
| 1937 | } |
| 1938 | |
| 1939 | /** |
| 1940 | * Updates cached nearest town for all road tiles |
no test coverage detected