MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DoPlantForest

Method DoPlantForest

src/tree_gui.cpp:129–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127 }
128
129 void DoPlantForest(TileIndex tile)
130 {
131 TreeType treetype = (TreeType)this->tree_to_plant;
132 if (this->tree_to_plant == TREE_INVALID) {
133 treetype = (TreeType)(InteractiveRandomRange(_tree_count_by_landscape[to_underlying(_settings_game.game_creation.landscape)]) + _tree_base_by_landscape[to_underlying(_settings_game.game_creation.landscape)]);
134 }
135 const uint radius = this->mode == PM_FOREST_LG ? 12 : 5;
136 const uint count = this->mode == PM_FOREST_LG ? 12 : 5;
137 /* Create tropic zones only when the tree type is selected by the user and not picked randomly. */
138 PlaceTreeGroupAroundTile(tile, treetype, radius, count, this->tree_to_plant != TREE_INVALID);
139 }
140
141public:
142 BuildTreesWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)

Callers 1

OnPlaceDragMethod · 0.95

Calls 3

InteractiveRandomRangeFunction · 0.85
to_underlyingFunction · 0.85
PlaceTreeGroupAroundTileFunction · 0.85

Tested by

no test coverage detected