forked from mirror/OpenTTD
Add: [NewGRF] All callbacks returning D0xx strings, have now the option to return any string id via register 0x100.
This commit is contained in:
@@ -862,15 +862,19 @@ static void GetTileDesc_Town(TileIndex tile, TileDesc &td)
|
||||
td.str = hs->building_name;
|
||||
td.town_can_upgrade = !IsHouseProtected(tile);
|
||||
|
||||
uint16_t callback_res = GetHouseCallback(CBID_HOUSE_CUSTOM_NAME, house_completed ? 1 : 0, 0, house, Town::GetByTile(tile), tile);
|
||||
std::array<int32_t, 1> regs100;
|
||||
uint16_t callback_res = GetHouseCallback(CBID_HOUSE_CUSTOM_NAME, house_completed ? 1 : 0, 0, house, Town::GetByTile(tile), tile, regs100);
|
||||
if (callback_res != CALLBACK_FAILED && callback_res != 0x400) {
|
||||
if (callback_res > 0x400) {
|
||||
StringID new_name = STR_NULL;
|
||||
if (callback_res == 0x40F) {
|
||||
new_name = GetGRFStringID(hs->grf_prop.grfid, static_cast<GRFStringID>(regs100[0]));
|
||||
} else if (callback_res > 0x400) {
|
||||
ErrorUnknownCallbackResult(hs->grf_prop.grfid, CBID_HOUSE_CUSTOM_NAME, callback_res);
|
||||
} else {
|
||||
StringID new_name = GetGRFStringID(hs->grf_prop.grfid, GRFSTR_MISC_GRF_TEXT + callback_res);
|
||||
if (new_name != STR_NULL && new_name != STR_UNDEFINED) {
|
||||
td.str = new_name;
|
||||
}
|
||||
new_name = GetGRFStringID(hs->grf_prop.grfid, GRFSTR_MISC_GRF_TEXT + callback_res);
|
||||
}
|
||||
if (new_name != STR_NULL && new_name != STR_UNDEFINED) {
|
||||
td.str = new_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user