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

Function GetGRFStringID

src/newgrf_text.cpp:580–589  ·  view source on GitHub ↗

* Returns the index for this stringid associated with its grfID */

Source from the content-addressed store, hash-verified

578 * Returns the index for this stringid associated with its grfID
579 */
580StringID GetGRFStringID(uint32_t grfid, GRFStringID stringid)
581{
582 auto it = std::ranges::find_if(_grf_text, [&grfid, &stringid](const GRFTextEntry &grf_text) { return grf_text.grfid == grfid && grf_text.stringid == stringid; });
583 if (it != std::end(_grf_text)) {
584 StringIndexInTab id(it - std::begin(_grf_text));
585 return MakeStringID(TEXT_TAB_NEWGRF_START, id);
586 }
587
588 return STR_UNDEFINED;
589}
590
591
592/**

Callers 9

GetHouseNameFunction · 0.85
CheckTrainAttachmentFunction · 0.85
CmdStartStopVehicleFunction · 0.85
GetCargoSubtypeTextFunction · 0.85
GetAirportTextCallbackFunction · 0.85
GetTileDesc_TownFunction · 0.85
MapGRFStringIDFunction · 0.85

Calls 3

MakeStringIDFunction · 0.85
endFunction · 0.50
beginFunction · 0.50

Tested by

no test coverage detected