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

Function GetCargoTranslationTable

src/newgrf.cpp:521–531  ·  view source on GitHub ↗

* Get the cargo translation table to use for the given GRF file. * @param grffile GRF file. * @returns Readonly cargo translation table to use. */

Source from the content-addressed store, hash-verified

519 * @returns Readonly cargo translation table to use.
520 */
521 std::span<const CargoLabel> GetCargoTranslationTable(const GRFFile &grffile)
522 {
523 /* Always use the translation table if it's installed. */
524 if (!grffile.cargo_list.empty()) return grffile.cargo_list;
525
526 /* Pre-v7 use climate-dependent "slot" table. */
527 if (grffile.grf_version < 7) return GetClimateDependentCargoTranslationTable();
528
529 /* Otherwise use climate-independent "bitnum" table. */
530 return GetClimateIndependentCargoTranslationTable();
531 }
532
533/**
534 * Construct the Cargo Mapping

Callers 3

BuildCargoTranslationMapFunction · 0.85
TranslateCargoFunction · 0.85

Tested by

no test coverage detected