1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 17:02:37 +01:00

Add: [NewGRF] All callbacks returning D0xx strings, have now the option to return any string id via register 0x100.

This commit is contained in:
frosch
2025-05-06 17:28:51 +02:00
committed by frosch
parent 84bc78fd8f
commit c6fa5022cb
11 changed files with 114 additions and 54 deletions

View File

@@ -1613,7 +1613,13 @@ static void FormatString(StringBuilder &builder, std::string_view str_arg, Strin
std::array<int32_t, 6> regs100;
uint16_t callback = GetVehicleCallback(CBID_VEHICLE_NAME, static_cast<uint32_t>(arg >> 32), 0, e->index, nullptr, regs100);
/* Not calling ErrorUnknownCallbackResult due to being inside string processing. */
if (callback != CALLBACK_FAILED && callback < 0x400) {
if (callback == 0x40F) {
const GRFFile *grffile = e->GetGRF();
assert(grffile != nullptr);
builder += GetGRFStringWithTextStack(grffile, static_cast<GRFStringID>(regs100[0]), std::span{regs100}.subspan(1));
break;
} else if (callback < 0x400) {
const GRFFile *grffile = e->GetGRF();
assert(grffile != nullptr);