| 4152 | }); |
| 4153 | |
| 4154 | static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlags flags, int z_new, Slope tileh_new) |
| 4155 | { |
| 4156 | if (AutoslopeEnabled()) { |
| 4157 | HouseID house = GetHouseType(tile); |
| 4158 | GetHouseNorthPart(house); // modifies house to the ID of the north tile |
| 4159 | const HouseSpec *hs = HouseSpec::Get(house); |
| 4160 | |
| 4161 | /* Here we differ from TTDP by checking BuildingFlag::NotSloped */ |
| 4162 | if (!hs->building_flags.Test(BuildingFlag::NotSloped) && !IsSteepSlope(tileh_new) && |
| 4163 | (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new))) { |
| 4164 | bool allow_terraform = true; |
| 4165 | |
| 4166 | /* Call the autosloping callback per tile, not for the whole building at once. */ |
| 4167 | house = GetHouseType(tile); |
| 4168 | hs = HouseSpec::Get(house); |
| 4169 | if (hs->callback_mask.Test(HouseCallbackMask::Autoslope)) { |
| 4170 | /* If the callback fails, allow autoslope. */ |
| 4171 | uint16_t res = GetHouseCallback(CBID_HOUSE_AUTOSLOPE, 0, 0, house, Town::GetByTile(tile), tile); |
| 4172 | if (res != CALLBACK_FAILED && ConvertBooleanCallback(hs->grf_prop.grffile, CBID_HOUSE_AUTOSLOPE, res)) allow_terraform = false; |
| 4173 | } |
| 4174 | |
| 4175 | if (allow_terraform) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); |
| 4176 | } |
| 4177 | } |
| 4178 | |
| 4179 | return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile); |
| 4180 | } |
| 4181 | |
| 4182 | /** Tile callback functions for a town */ |
| 4183 | extern const TileTypeProcs _tile_type_town_procs = { |
nothing calls this directly
no test coverage detected