1
0
Fork 0

Fix: [NewGRF] String parameter stack and case selection were not processed for control code 0x81. (#13851)

pull/13852/head
frosch 2025-03-21 18:13:08 +01:00 committed by GitHub
parent a4f9977d18
commit a4f3ddae5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -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;

View File

@ -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;
}