mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-16 08:52:40 +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:
@@ -240,13 +240,16 @@ public:
|
||||
std::array<int32_t, 6> regs100;
|
||||
uint16_t callback_res = GetObjectCallback(CBID_OBJECT_FUND_MORE_TEXT, 0, 0, spec, nullptr, INVALID_TILE, regs100, _object_gui.sel_view);
|
||||
if (callback_res != CALLBACK_FAILED && callback_res != 0x400) {
|
||||
if (callback_res > 0x400) {
|
||||
std::string str;
|
||||
if (callback_res == 0x40F) {
|
||||
str = GetGRFStringWithTextStack(spec->grf_prop.grffile, static_cast<GRFStringID>(regs100[0]), std::span{regs100}.subspan(1));
|
||||
} else if (callback_res > 0x400) {
|
||||
ErrorUnknownCallbackResult(spec->grf_prop.grfid, CBID_OBJECT_FUND_MORE_TEXT, callback_res);
|
||||
} else {
|
||||
std::string str = GetGRFStringWithTextStack(spec->grf_prop.grffile, GRFSTR_MISC_GRF_TEXT + callback_res, regs100);
|
||||
if (!str.empty()) {
|
||||
tr.top = DrawStringMultiLine(tr, str, TC_ORANGE);
|
||||
}
|
||||
str = GetGRFStringWithTextStack(spec->grf_prop.grffile, GRFSTR_MISC_GRF_TEXT + callback_res, regs100);
|
||||
}
|
||||
if (!str.empty()) {
|
||||
tr.top = DrawStringMultiLine(tr, str, TC_ORANGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user