| 3265 | } |
| 3266 | |
| 3267 | static void DrawTile_Station(TileInfo *ti) |
| 3268 | { |
| 3269 | const NewGRFSpriteLayout *layout = nullptr; |
| 3270 | SpriteLayoutProcessor processor; // owns heap, borrowed by tmp_layout and t |
| 3271 | DrawTileSpriteSpan tmp_layout; |
| 3272 | const DrawTileSprites *t = nullptr; |
| 3273 | int32_t total_offset; |
| 3274 | const RailTypeInfo *rti = nullptr; |
| 3275 | uint32_t relocation = 0; |
| 3276 | uint32_t ground_relocation = 0; |
| 3277 | BaseStation *st = nullptr; |
| 3278 | const StationSpec *statspec = nullptr; |
| 3279 | uint tile_layout = 0; |
| 3280 | auto bridgeable_info = GetStationBridgeableTileInfo(GetStationType(ti->tile)); |
| 3281 | |
| 3282 | if (HasStationRail(ti->tile)) { |
| 3283 | rti = GetRailTypeInfo(GetRailType(ti->tile)); |
| 3284 | total_offset = rti->GetRailtypeSpriteOffset(); |
| 3285 | |
| 3286 | if (IsCustomStationSpecIndex(ti->tile)) { |
| 3287 | /* look for customization */ |
| 3288 | st = BaseStation::GetByTile(ti->tile); |
| 3289 | statspec = st->speclist[GetCustomStationSpecIndex(ti->tile)].spec; |
| 3290 | |
| 3291 | if (statspec != nullptr) { |
| 3292 | tile_layout = GetStationGfx(ti->tile); |
| 3293 | |
| 3294 | if (statspec->callback_mask.Test(StationCallbackMask::DrawTileLayout)) { |
| 3295 | uint16_t callback = GetStationCallback(CBID_STATION_DRAW_TILE_LAYOUT, 0, 0, statspec, st, ti->tile); |
| 3296 | if (callback != CALLBACK_FAILED) tile_layout = (callback & ~1) + GetRailStationAxis(ti->tile); |
| 3297 | } |
| 3298 | |
| 3299 | /* Ensure the chosen tile layout is valid for this custom station */ |
| 3300 | if (!statspec->renderdata.empty()) { |
| 3301 | layout = &statspec->renderdata[tile_layout < statspec->renderdata.size() ? tile_layout : (uint)GetRailStationAxis(ti->tile)]; |
| 3302 | if (!layout->NeedsPreprocessing()) { |
| 3303 | t = layout; |
| 3304 | layout = nullptr; |
| 3305 | } |
| 3306 | } |
| 3307 | } |
| 3308 | } |
| 3309 | if (statspec != nullptr) bridgeable_info = statspec->bridgeable_info; |
| 3310 | } else { |
| 3311 | total_offset = 0; |
| 3312 | } |
| 3313 | |
| 3314 | StationGfx gfx = GetStationGfx(ti->tile); |
| 3315 | if (IsAirport(ti->tile)) { |
| 3316 | gfx = GetAirportGfx(ti->tile); |
| 3317 | if (gfx >= NEW_AIRPORTTILE_OFFSET) { |
| 3318 | const AirportTileSpec *ats = AirportTileSpec::Get(gfx); |
| 3319 | if (ats->grf_prop.HasSpriteGroups() && DrawNewAirportTile(ti, Station::GetByTile(ti->tile), ats)) { |
| 3320 | return; |
| 3321 | } |
| 3322 | /* No sprite group (or no valid one) found, meaning no graphics associated. |
| 3323 | * Use the substitute one instead */ |
| 3324 | assert(ats->grf_prop.subst_id != INVALID_AIRPORTTILE); |
nothing calls this directly
no test coverage detected