diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index c13448d26e..d4a948d62e 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -840,6 +840,13 @@ static void ProcessNewGRFStringControlCode(char32_t scc, const char *&str, TextR params.emplace_back(stack.PopUnsignedWord()); break; + case SCC_NEWGRF_STRINL: { + StringID stringid = Utf8Consume(str); + /* We also need to handle the substring's stack usage. */ + HandleNewGRFStringControlCodes(GetStringPtr(stringid), stack, params); + break; + } + case SCC_NEWGRF_PRINT_WORD_STRING_ID: { StringID stringid = MapGRFStringID(stack.grffile->grfid, GRFStringID{stack.PopUnsignedWord()}); params.emplace_back(stringid); @@ -884,9 +891,6 @@ char32_t RemapNewGRFStringControlCode(char32_t scc, const char **str) case SCC_NEWGRF_PRINT_QWORD_CURRENCY: return SCC_CURRENCY_LONG; - case SCC_NEWGRF_PRINT_WORD_STRING_ID: - return SCC_NEWGRF_PRINT_WORD_STRING_ID; - case SCC_NEWGRF_PRINT_WORD_DATE_LONG: case SCC_NEWGRF_PRINT_DWORD_DATE_LONG: return SCC_DATE_LONG; diff --git a/src/strings.cpp b/src/strings.cpp index 84496630d0..397fca491c 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1133,6 +1133,8 @@ static void FormatString(StringBuilder &builder, const char *str_arg, StringPara } else { str_stack.push(ptr); } + case_index = next_substr_case_index; + next_substr_case_index = 0; break; }