MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DrawTrainDepotSprite

Function DrawTrainDepotSprite

src/rail_cmd.cpp:2550–2575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2548}
2549
2550void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
2551{
2552 const DrawTileSprites *dts = &_depot_gfx_table[dir];
2553 const RailTypeInfo *rti = GetRailTypeInfo(railtype);
2554 SpriteID image = rti->UsesOverlay() ? SPR_FLAT_GRASS_TILE : dts->ground.sprite;
2555 uint32_t offset = rti->GetRailtypeSpriteOffset();
2556
2557 if (image != SPR_FLAT_GRASS_TILE) image += offset;
2558 PaletteID palette = GetCompanyPalette(_local_company);
2559
2560 DrawSprite(image, PAL_NONE, x, y);
2561
2562 if (rti->UsesOverlay()) {
2563 SpriteID ground = GetCustomRailSprite(rti, INVALID_TILE, RTSG_GROUND);
2564
2565 switch (dir) {
2566 case DIAGDIR_SW: DrawSprite(ground + RTO_X, PAL_NONE, x, y); break;
2567 case DIAGDIR_SE: DrawSprite(ground + RTO_Y, PAL_NONE, x, y); break;
2568 default: break;
2569 }
2570 }
2571 int depot_sprite = GetCustomRailSprite(rti, INVALID_TILE, RTSG_DEPOT);
2572 if (depot_sprite != 0) offset = depot_sprite - SPR_RAIL_DEPOT_SE_1;
2573
2574 DrawRailTileSeqInGUI(x, y, dts, offset, 0, palette);
2575}
2576
2577static int GetSlopePixelZ_Track(TileIndex tile, uint x, uint y, bool)
2578{

Callers 1

DrawWidgetMethod · 0.85

Calls 7

GetRailTypeInfoFunction · 0.85
GetCompanyPaletteFunction · 0.85
DrawSpriteFunction · 0.85
GetCustomRailSpriteFunction · 0.85
DrawRailTileSeqInGUIFunction · 0.85
UsesOverlayMethod · 0.45

Tested by

no test coverage detected