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

Method GetCargoIcon

src/cargotype.cpp:176–187  ·  view source on GitHub ↗

* Get sprite for showing cargo of this type. * @return Sprite number to use. */

Source from the content-addressed store, hash-verified

174 * @return Sprite number to use.
175 */
176SpriteID CargoSpec::GetCargoIcon() const
177{
178 SpriteID sprite = this->sprite;
179 if (sprite == 0xFFFF) {
180 /* A value of 0xFFFF indicates we should draw a custom icon */
181 sprite = GetCustomCargoSprite(this);
182 }
183
184 if (sprite == 0) sprite = SPR_CARGO_GOODS;
185
186 return sprite;
187}
188
189std::array<uint8_t, NUM_CARGO> _sorted_cargo_types; ///< Sort order of cargoes by cargo type.
190std::vector<const CargoSpec *> _sorted_cargo_specs; ///< Cargo specifications sorted alphabetically by name.

Callers 10

DrawCargoIconMethod · 0.80
DrawCargoIconMethod · 0.80
OnClickMethod · 0.80
GetLargestCargoIconSizeFunction · 0.80
DrawCargoIconsMethod · 0.80
DrawCargoIconOverlayFunction · 0.80

Calls 1

GetCustomCargoSpriteFunction · 0.85

Tested by

no test coverage detected