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

Function GetGRFConfig

src/newgrf_config.cpp:622–628  ·  view source on GitHub ↗

* Retrieve a NewGRF from the current config by its grfid. * @param grfid grf to look for. * @param mask GRFID mask to allow for partial matching. * @return The grf config, if it exists, else \c nullptr. */

Source from the content-addressed store, hash-verified

620 * @return The grf config, if it exists, else \c nullptr.
621 */
622GRFConfig *GetGRFConfig(uint32_t grfid, uint32_t mask)
623{
624 auto it = std::ranges::find_if(_grfconfig, [grfid, mask](const auto &c) { return (c->ident.grfid & mask) == (grfid & mask); });
625 if (it != std::end(_grfconfig)) return it->get();
626
627 return nullptr;
628}
629
630
631/** Build a string containing space separated parameter values, and terminate */

Callers 15

GetTileDesc_IndustryFunction · 0.85
ShowNewGrfVehicleErrorFunction · 0.85
VehicleLengthChangedFunction · 0.85
GetTileDesc_ObjectFunction · 0.85
FillTileDescRailStationFunction · 0.85
FillTileDescAirportFunction · 0.85
GetTileDesc_StationFunction · 0.85
DrawVehiclePurchaseInfoFunction · 0.85
GetTileDesc_TownFunction · 0.85
GetGlobalVariableFunction · 0.85
SafeChangeInfoFunction · 0.85

Calls 2

endFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected