* Draw a house and its tile. This is a tile callback routine. * @param ti TileInfo of the tile to draw */
| 262 | * @param ti TileInfo of the tile to draw |
| 263 | */ |
| 264 | static void DrawTile_Town(TileInfo *ti) |
| 265 | { |
| 266 | HouseID house_id = GetHouseType(ti->tile); |
| 267 | |
| 268 | if (house_id >= NEW_HOUSE_OFFSET) { |
| 269 | /* Houses don't necessarily need new graphics. If they don't have a |
| 270 | * spritegroup associated with them, then the sprite for the substitute |
| 271 | * house id is drawn instead. */ |
| 272 | if (HouseSpec::Get(house_id)->grf_prop.HasSpriteGroups()) { |
| 273 | DrawNewHouseTile(ti, house_id); |
| 274 | return; |
| 275 | } else { |
| 276 | house_id = HouseSpec::Get(house_id)->grf_prop.subst_id; |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | /* Retrieve pointer to the draw town tile struct */ |
| 281 | const DrawBuildingsTileStruct *dcts = &_town_draw_tile_data[house_id << 4 | TileHash2Bit(ti->x, ti->y) << 2 | GetHouseBuildingStage(ti->tile)]; |
| 282 | |
| 283 | if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED); |
| 284 | |
| 285 | DrawGroundSprite(dcts->ground.sprite, dcts->ground.pal); |
| 286 | |
| 287 | /* If houses are invisible, do not draw the upper part */ |
| 288 | if (IsInvisibilitySet(TO_HOUSES)) return; |
| 289 | |
| 290 | /* Add a house on top of the ground? */ |
| 291 | SpriteID image = dcts->building.sprite; |
| 292 | if (image != 0) { |
| 293 | AddSortableSpriteToDraw(image, dcts->building.pal, *ti, *dcts, IsTransparencySet(TO_HOUSES)); |
| 294 | |
| 295 | if (IsTransparencySet(TO_HOUSES)) return; |
| 296 | } |
| 297 | |
| 298 | { |
| 299 | int proc = dcts->draw_proc - 1; |
| 300 | |
| 301 | if (proc >= 0) _town_draw_tile_procs[proc](ti); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | static int GetSlopePixelZ_Town(TileIndex tile, uint, uint, bool) |
| 306 | { |
nothing calls this directly
no test coverage detected