| 773 | } |
| 774 | |
| 775 | static void TileLoopTreesAlps(TileIndex tile) |
| 776 | { |
| 777 | int k = GetTileZ(tile) - GetSnowLine() + 1; |
| 778 | |
| 779 | if (k < 0) { |
| 780 | switch (GetTreeGround(tile)) { |
| 781 | case TREE_GROUND_SNOW_DESERT: SetTreeGroundDensity(tile, TREE_GROUND_GRASS, 3); break; |
| 782 | case TREE_GROUND_ROUGH_SNOW: SetTreeGroundDensity(tile, TREE_GROUND_ROUGH, 3); break; |
| 783 | default: return; |
| 784 | } |
| 785 | } else { |
| 786 | uint density = std::min<uint>(k, 3); |
| 787 | |
| 788 | if (GetTreeGround(tile) != TREE_GROUND_SNOW_DESERT && GetTreeGround(tile) != TREE_GROUND_ROUGH_SNOW) { |
| 789 | TreeGround tg = GetTreeGround(tile) == TREE_GROUND_ROUGH ? TREE_GROUND_ROUGH_SNOW : TREE_GROUND_SNOW_DESERT; |
| 790 | SetTreeGroundDensity(tile, tg, density); |
| 791 | } else if (GetTreeDensity(tile) != density) { |
| 792 | SetTreeGroundDensity(tile, GetTreeGround(tile), density); |
| 793 | } else { |
| 794 | if (GetTreeDensity(tile) == 3) { |
| 795 | uint32_t r = Random(); |
| 796 | if (Chance16I(1, 200, r) && _settings_client.sound.ambient) { |
| 797 | SndPlayTileFx((r & 0x80000000) ? SND_39_ARCTIC_SNOW_2 : SND_34_ARCTIC_SNOW_1, tile); |
| 798 | } |
| 799 | } |
| 800 | return; |
| 801 | } |
| 802 | } |
| 803 | MarkTileDirtyByTile(tile); |
| 804 | } |
| 805 | |
| 806 | /* |
| 807 | * Check if trees on this tile are allowed to spread. |
no test coverage detected