OpenTTD Source 20260208-master-g43af8e94d0
tree_cmd.h File Reference

Command definitions related to tree tiles. More...

#include "command_type.h"

Go to the source code of this file.

Functions

void PlaceTree (TileIndex tile, uint32_t r, bool keep_density=false)
 Make a random tree tile of the given tile.
CommandCost CmdPlantTree (DoCommandFlags flags, TileIndex tile, TileIndex start_tile, uint8_t tree_to_plant, bool diagonal)
 Plant a tree.

Detailed Description

Command definitions related to tree tiles.

Definition in file tree_cmd.h.

Function Documentation

◆ CmdPlantTree()

CommandCost CmdPlantTree ( DoCommandFlags flags,
TileIndex tile,
TileIndex start_tile,
uint8_t tree_to_plant,
bool diagonal )

◆ PlaceTree()

void PlaceTree ( TileIndex tile,
uint32_t r,
bool keep_density )

Make a random tree tile of the given tile.

Create a new tree-tile for the given tile. The second parameter is used for randomness like type and number of trees.

Parameters
tileThe tile to make a tree-tile from
rThe randomness value from a Random() value
keep_densityWhether to keep the existing ground density of the tile.

Definition at line 171 of file tree_cmd.cpp.

References GB(), GetRandomTreeType(), GetTreeGround(), MarkTileDirtyByTile(), PlantTreesOnTile(), RoughSnow, SetTreeGroundDensity(), Shore, SnowOrDesert, and TREE_INVALID.

Referenced by MakeWetlands(), PlaceTreeAtSameHeight(), PlaceTreeGroups(), and PlaceTreesRandomly().