| 2593 | } |
| 2594 | |
| 2595 | static void TileLoop_Track(TileIndex tile) |
| 2596 | { |
| 2597 | RailGroundType old_ground = GetRailGroundType(tile); |
| 2598 | RailGroundType new_ground; |
| 2599 | |
| 2600 | if (old_ground == RailGroundType::HalfTileWater) { |
| 2601 | TileLoop_Water(tile); |
| 2602 | return; |
| 2603 | } |
| 2604 | |
| 2605 | switch (_settings_game.game_creation.landscape) { |
| 2606 | case LandscapeType::Arctic: { |
| 2607 | auto [slope, z] = GetTileSlopeZ(tile); |
| 2608 | bool half = false; |
| 2609 | |
| 2610 | /* for non-flat track, use lower part of track |
| 2611 | * in other cases, use the highest part with track */ |
| 2612 | if (IsPlainRail(tile)) { |
| 2613 | TrackBits track = GetTrackBits(tile); |
| 2614 | Foundation f = GetRailFoundation(slope, track); |
| 2615 | |
| 2616 | switch (f) { |
| 2617 | case FOUNDATION_NONE: |
| 2618 | /* no foundation - is the track on the upper side of three corners raised tile? */ |
| 2619 | if (IsSlopeWithThreeCornersRaised(slope)) z++; |
| 2620 | break; |
| 2621 | |
| 2622 | case FOUNDATION_INCLINED_X: |
| 2623 | case FOUNDATION_INCLINED_Y: |
| 2624 | /* sloped track - is it on a steep slope? */ |
| 2625 | if (IsSteepSlope(slope)) z++; |
| 2626 | break; |
| 2627 | |
| 2628 | case FOUNDATION_STEEP_LOWER: |
| 2629 | /* only lower part of steep slope */ |
| 2630 | z++; |
| 2631 | break; |
| 2632 | |
| 2633 | default: |
| 2634 | /* if it is a steep slope, then there is a track on higher part */ |
| 2635 | if (IsSteepSlope(slope)) z++; |
| 2636 | z++; |
| 2637 | break; |
| 2638 | } |
| 2639 | |
| 2640 | half = IsInsideMM(f, FOUNDATION_STEEP_BOTH, FOUNDATION_HALFTILE_N + 1); |
| 2641 | } else { |
| 2642 | /* is the depot on a non-flat tile? */ |
| 2643 | if (slope != SLOPE_FLAT) z++; |
| 2644 | } |
| 2645 | |
| 2646 | /* 'z' is now the lowest part of the highest track bit - |
| 2647 | * for sloped track, it is 'z' of lower part |
| 2648 | * for two track bits, it is 'z' of higher track bit |
| 2649 | * For non-continuous foundations (and STEEP_BOTH), 'half' is set */ |
| 2650 | if (z > GetSnowLine()) { |
| 2651 | if (half && z - GetSnowLine() == 1) { |
| 2652 | /* track on non-continuous foundation, lower part is not under snow */ |
nothing calls this directly
no test coverage detected