| 981 | } |
| 982 | |
| 983 | void OnTick_Trees() |
| 984 | { |
| 985 | /* Don't spread trees if that's not allowed */ |
| 986 | if (_settings_game.construction.extra_tree_placement == ETP_NO_SPREAD || _settings_game.construction.extra_tree_placement == ETP_NO_GROWTH_NO_SPREAD) return; |
| 987 | |
| 988 | /* Skip some tree ticks for map sizes below 256 * 256. 64 * 64 is 16 times smaller, so |
| 989 | * this is the maximum number of ticks that are skipped. Number of ticks to skip is |
| 990 | * inversely proportional to map size, so that is handled to create a mask. */ |
| 991 | int skip = Map::ScaleBySize(16); |
| 992 | if (skip < 16 && (TimerGameTick::counter & (16 / skip - 1)) != 0) return; |
| 993 | |
| 994 | /* place a tree at a random rainforest spot */ |
| 995 | if (_settings_game.game_creation.landscape == LandscapeType::Tropic) { |
| 996 | for (uint c = Map::ScaleBySize(1); c > 0; c--) { |
| 997 | PlantRandomTree(true); |
| 998 | } |
| 999 | } |
| 1000 | |
| 1001 | if (!DecrementTreeCounter() || _settings_game.construction.extra_tree_placement == ETP_SPREAD_RAINFOREST) return; |
| 1002 | |
| 1003 | /* place a tree at a random spot */ |
| 1004 | PlantRandomTree(false); |
| 1005 | } |
| 1006 | |
| 1007 | static TrackStatus GetTileTrackStatus_Trees(TileIndex, TransportType, uint, DiagDirection) |
| 1008 | { |
no test coverage detected