* Determines if a given HouseID is part of a multitile house. * The given ID is set to the ID of the north tile and the TileDiff to the north tile is returned. * * @param house Is changed to the HouseID of the north tile of the same house * @return TileDiff from the tile of the given HouseID to the north tile */
| 3023 | * @return TileDiff from the tile of the given HouseID to the north tile |
| 3024 | */ |
| 3025 | TileIndexDiff GetHouseNorthPart(HouseID &house) |
| 3026 | { |
| 3027 | if (house >= 3) { // house id 0,1,2 MUST be single tile houses, or this code breaks. |
| 3028 | if (HouseSpec::Get(house - 1)->building_flags.Test(BuildingFlag::Size2x1)) { |
| 3029 | house--; |
| 3030 | return TileDiffXY(-1, 0); |
| 3031 | } else if (HouseSpec::Get(house - 1)->building_flags.Any(BUILDING_2_TILES_Y)) { |
| 3032 | house--; |
| 3033 | return TileDiffXY(0, -1); |
| 3034 | } else if (HouseSpec::Get(house - 2)->building_flags.Any(BUILDING_HAS_4_TILES)) { |
| 3035 | house -= 2; |
| 3036 | return TileDiffXY(-1, 0); |
| 3037 | } else if (HouseSpec::Get(house - 3)->building_flags.Any(BUILDING_HAS_4_TILES)) { |
| 3038 | house -= 3; |
| 3039 | return TileDiffXY(-1, -1); |
| 3040 | } |
| 3041 | } |
| 3042 | return TileDiffXY(0, 0); |
| 3043 | } |
| 3044 | |
| 3045 | /** |
| 3046 | * Clear a town house. |
no test coverage detected