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

Function GetActiveCargoLabel

src/newgrf.cpp:612–619  ·  view source on GitHub ↗

* Find first cargo label that exists and is active from a list of cargo labels. * @param labels List of cargo labels. * @returns First cargo label in list that exists, or CT_INVALID if none exist. */

Source from the content-addressed store, hash-verified

610 * @returns First cargo label in list that exists, or CT_INVALID if none exist.
611 */
612static CargoLabel GetActiveCargoLabel(const std::initializer_list<CargoLabel> &labels)
613{
614 for (const CargoLabel &label : labels) {
615 CargoType cargo_type = GetCargoTypeByLabel(label);
616 if (cargo_type != INVALID_CARGO) return label;
617 }
618 return CT_INVALID;
619}
620
621/**
622 * Get active cargo label from either a cargo label or climate-dependent mixed cargo type.

Callers 3

operator()Method · 0.85
CalculateRefitMasksFunction · 0.85
FinaliseIndustriesArrayFunction · 0.85

Calls 1

GetCargoTypeByLabelFunction · 0.85

Tested by

no test coverage detected