MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetTileDesc_Town

Function GetTileDesc_Town

src/town_cmd.cpp:866–902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

864}
865
866static void GetTileDesc_Town(TileIndex tile, TileDesc &td)
867{
868 const HouseID house = GetHouseType(tile);
869 const HouseSpec *hs = HouseSpec::Get(house);
870 bool house_completed = IsHouseCompleted(tile);
871
872 td.str = hs->building_name;
873 td.town_can_upgrade = !IsHouseProtected(tile);
874
875 std::array<int32_t, 1> regs100;
876 uint16_t callback_res = GetHouseCallback(CBID_HOUSE_CUSTOM_NAME, house_completed ? 1 : 0, 0, house, Town::GetByTile(tile), tile, regs100);
877 if (callback_res != CALLBACK_FAILED && callback_res != 0x400) {
878 StringID new_name = STR_NULL;
879 if (callback_res == 0x40F) {
880 new_name = GetGRFStringID(hs->grf_prop.grfid, static_cast<GRFStringID>(regs100[0]));
881 } else if (callback_res > 0x400) {
882 ErrorUnknownCallbackResult(hs->grf_prop.grfid, CBID_HOUSE_CUSTOM_NAME, callback_res);
883 } else {
884 new_name = GetGRFStringID(hs->grf_prop.grfid, GRFSTR_MISC_GRF_TEXT + callback_res);
885 }
886 if (new_name != STR_NULL && new_name != STR_UNDEFINED) {
887 td.str = new_name;
888 }
889 }
890
891 if (!house_completed) {
892 td.dparam = td.str;
893 td.str = STR_LAI_TOWN_INDUSTRY_DESCRIPTION_UNDER_CONSTRUCTION;
894 }
895
896 if (hs->grf_prop.HasGrfFile()) {
897 const GRFConfig *gc = GetGRFConfig(hs->grf_prop.grfid);
898 td.grf = gc->GetName();
899 }
900
901 td.owner[0] = OWNER_TOWN;
902}
903
904static TrackStatus GetTileTrackStatus_Town(TileIndex, TransportType, uint, DiagDirection)
905{

Callers

nothing calls this directly

Calls 9

GetHouseTypeFunction · 0.85
IsHouseCompletedFunction · 0.85
IsHouseProtectedFunction · 0.85
GetHouseCallbackFunction · 0.85
GetGRFStringIDFunction · 0.85
GetGRFConfigFunction · 0.85
HasGrfFileMethod · 0.80
GetNameMethod · 0.45

Tested by

no test coverage detected