OpenTTD Source
20241121-master-g67a0fccfad
|
GUIs for building trees. More...
#include "stdafx.h"
#include "window_gui.h"
#include "gfx_func.h"
#include "tilehighlight_func.h"
#include "company_func.h"
#include "company_base.h"
#include "command_func.h"
#include "core/random_func.hpp"
#include "sound_func.h"
#include "strings_func.h"
#include "zoom_func.h"
#include "tree_map.h"
#include "tree_cmd.h"
#include "widgets/tree_widget.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "table/tree_land.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
class | BuildTreesWindow |
The build trees window. More... | |
Functions | |
void | PlaceTreesRandomly () |
Place some trees randomly. More... | |
uint | PlaceTreeGroupAroundTile (TileIndex tile, TreeType treetype, uint radius, uint count, bool set_zone) |
Place some trees in a radius around a tile. More... | |
static Dimension | GetMaxTreeSpriteSize () |
Calculate the maximum size of all tree sprites. More... | |
static std::unique_ptr< NWidgetBase > | MakeTreeTypeButtons () |
Make widgets for the current available tree types. More... | |
void | ShowBuildTreesToolbar () |
Variables | |
const PalSpriteID | tree_sprites [] |
Tree Sprites with their palettes. More... | |
static constexpr NWidgetPart | _nested_build_trees_widgets [] |
static WindowDesc | _build_trees_desc (WDP_AUTO, "build_tree", 0, 0, WC_BUILD_TREES, WC_NONE, WDF_CONSTRUCTION, _nested_build_trees_widgets) |
GUIs for building trees.
Definition in file tree_gui.cpp.
|
static |
Calculate the maximum size of all tree sprites.
Definition at line 53 of file tree_gui.cpp.
|
static |
Make widgets for the current available tree types.
This does not use a NWID_MATRIX or WWT_MATRIX control as those are more difficult to get producing the correct result than dynamically building the widgets is.
Definition at line 259 of file tree_gui.cpp.
uint PlaceTreeGroupAroundTile | ( | TileIndex | tile, |
TreeType | treetype, | ||
uint | radius, | ||
uint | count, | ||
bool | set_zone | ||
) |
Place some trees in a radius around a tile.
The trees are placed in an quasi-normal distribution around the indicated tile, meaning that while the radius does define a square, the distribution inside the square will be roughly circular.
tile | Tile to place trees around. |
treetype | Type of trees to place. Must be a valid tree type for the climate. |
radius | Maximum distance (on each axis) from tile to place trees. |
count | Maximum number of trees to place. |
set_zone | Whether to create a rainforest zone when placing rainforest trees. |
Definition at line 307 of file tree_cmd.cpp.
void PlaceTreesRandomly | ( | ) |
Place some trees randomly.
This function just place some trees randomly on the map.
Definition at line 247 of file tree_cmd.cpp.
References DEFAULT_TREE_STEPS, and Map::ScaleBySize().
|
staticconstexpr |
Definition at line 288 of file tree_gui.cpp.
const PalSpriteID tree_sprites[] |
Tree Sprites with their palettes.
Definition at line 36 of file tree_gui.cpp.