* Get a C-string from a stringid set by a newgrf. */
| 630 | * Get a C-string from a stringid set by a newgrf. |
| 631 | */ |
| 632 | std::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. |
no test coverage detected