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

Method DrawCargoIcon

src/industry_gui.cpp:852–859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

850 }
851
852 void DrawCargoIcon(const Rect &r, CargoType cargo_type) const
853 {
854 bool rtl = _current_text_dir == TD_RTL;
855 SpriteID icon = CargoSpec::Get(cargo_type)->GetCargoIcon();
856 Dimension d = GetSpriteSize(icon);
857 Rect ir = r.WithWidth(this->cargo_icon_size.width, rtl).WithHeight(GetCharacterHeight(FS_NORMAL));
858 DrawSprite(icon, PAL_NONE, CentreBounds(ir.left, ir.right, d.width), CentreBounds(ir.top, ir.bottom, this->cargo_icon_size.height));
859 }
860
861 std::string GetAcceptedCargoString(const Industry::AcceptedCargo &ac, const CargoSuffix &suffix) const
862 {

Callers

nothing calls this directly

Calls 7

GetSpriteSizeFunction · 0.85
GetCharacterHeightFunction · 0.85
DrawSpriteFunction · 0.85
CentreBoundsFunction · 0.85
GetCargoIconMethod · 0.80
WithHeightMethod · 0.80
WithWidthMethod · 0.80

Tested by

no test coverage detected