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

Function GetGRFStringPtr

src/newgrf_text.cpp:632–642  ·  view source on GitHub ↗

* Get a C-string from a stringid set by a newgrf. */

Source from the content-addressed store, hash-verified

630 * Get a C-string from a stringid set by a newgrf.
631 */
632std::string_view GetGRFStringPtr(StringIndexInTab stringid)
633{
634 assert(stringid.base() < _grf_text.size());
635 assert(_grf_text[stringid].grfid != 0);
636
637 auto str = GetGRFStringFromGRFText(_grf_text[stringid].textholder);
638 if (str.has_value()) return *str;
639
640 /* Use the default string ID if the fallback string isn't available */
641 return GetStringPtr(_grf_text[stringid].def_string);
642}
643
644/**
645 * Equivalence Setter function between game and newgrf langID.

Callers 2

GetStringPtrFunction · 0.85
GetStringWithArgsFunction · 0.85

Calls 4

GetGRFStringFromGRFTextFunction · 0.85
GetStringPtrFunction · 0.85
baseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected