* Returns the index for this stringid associated with its grfID */
| 578 | * Returns the index for this stringid associated with its grfID |
| 579 | */ |
| 580 | StringID 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 | /** |
no test coverage detected