* Get name for a prototype house. * @param hs HouseSpec of house. * @return StringID of name for house. */
| 1422 | * @return StringID of name for house. |
| 1423 | */ |
| 1424 | static StringID GetHouseName(const HouseSpec *hs) |
| 1425 | { |
| 1426 | std::array<int32_t, 1> regs100; |
| 1427 | uint16_t callback_res = GetHouseCallback(CBID_HOUSE_CUSTOM_NAME, 1, 0, hs->Index(), nullptr, INVALID_TILE, regs100, true); |
| 1428 | if (callback_res != CALLBACK_FAILED && callback_res != 0x400) { |
| 1429 | StringID new_name = STR_NULL; |
| 1430 | if (callback_res == 0x40F) { |
| 1431 | new_name = GetGRFStringID(hs->grf_prop.grffile->grfid, static_cast<GRFStringID>(regs100[0])); |
| 1432 | } else if (callback_res > 0x400) { |
| 1433 | ErrorUnknownCallbackResult(hs->grf_prop.grffile->grfid, CBID_HOUSE_CUSTOM_NAME, callback_res); |
| 1434 | } else { |
| 1435 | new_name = GetGRFStringID(hs->grf_prop.grffile->grfid, GRFSTR_MISC_GRF_TEXT + callback_res); |
| 1436 | } |
| 1437 | if (new_name != STR_NULL && new_name != STR_UNDEFINED) { |
| 1438 | return new_name; |
| 1439 | } |
| 1440 | } |
| 1441 | |
| 1442 | return hs->building_name; |
| 1443 | } |
| 1444 | |
| 1445 | class HousePickerCallbacks : public PickerCallbacks { |
| 1446 | public: |
no test coverage detected