mirror of https://github.com/OpenTTD/OpenTTD
Add: Set the tree line directly in Scenario Editor
parent
7e9162f89d
commit
849b8d917b
|
@ -2979,11 +2979,12 @@ STR_OBJECT_BUILD_SIZE :{BLACK}Size: {G
|
|||
STR_OBJECT_CLASS_LTHS :Lighthouses
|
||||
STR_OBJECT_CLASS_TRNS :Transmitters
|
||||
|
||||
# Tree planting window (last eight for SE only)
|
||||
# Tree planting window (in-game and Scenario Editor)
|
||||
STR_PLANT_TREE_CAPTION :{WHITE}Trees
|
||||
STR_PLANT_TREE_TOOLTIP :{BLACK}Select tree type to plant. If the tile already has a tree, this will add more trees of mixed types independent of the selected type
|
||||
STR_TREES_RANDOM_TYPE :{BLACK}Trees of random type
|
||||
STR_TREES_RANDOM_TYPE_TOOLTIP :{BLACK}Place trees of random type. Ctrl+Click+Drag to select the area diagonally. Also press Shift to show cost estimate only
|
||||
# Tree planting window (Scenario Editor only)
|
||||
STR_TREES_RANDOM_TREES_BUTTON :{BLACK}Random Trees
|
||||
STR_TREES_RANDOM_TREES_TOOLTIP :{BLACK}Plant trees randomly throughout the landscape
|
||||
STR_TREES_MODE_NORMAL_BUTTON :{BLACK}Normal
|
||||
|
@ -2992,6 +2993,10 @@ STR_TREES_MODE_FOREST_SM_BUTTON :{BLACK}Grove
|
|||
STR_TREES_MODE_FOREST_SM_TOOLTIP :{BLACK}Plant small forests by dragging over the landscape
|
||||
STR_TREES_MODE_FOREST_LG_BUTTON :{BLACK}Forest
|
||||
STR_TREES_MODE_FOREST_LG_TOOLTIP :{BLACK}Plant large forests by dragging over the landscape
|
||||
STR_BUILD_TREES_TREELINE_LABEL :{BLACK}Tree line height:
|
||||
STR_BUILD_TREES_TREELINE_TOOLTIP :{BLACK}Choose the tree line height. Above this level, trees will not grow
|
||||
STR_BUILD_TREES_TREELINE_DECREASE_TOOLTIP :{BLACK}Decrease the tree line height
|
||||
STR_BUILD_TREES_TREELINE_INCREASE_TOOLTIP :{BLACK}Increase the tree line height
|
||||
|
||||
# Land generation window (SE)
|
||||
STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION :{WHITE}Land Generation
|
||||
|
|
|
@ -149,6 +149,12 @@ public:
|
|||
if (_game_mode != GM_EDITOR) {
|
||||
this->GetWidget<NWidgetStacked>(WID_BT_SE_PANE)->SetDisplayedPlane(SZSP_HORIZONTAL);
|
||||
}
|
||||
|
||||
/* Only show tree line in subarctic climate. */
|
||||
if (_settings_game.game_creation.landscape != LT_ARCTIC) {
|
||||
this->GetWidget<NWidgetStacked>(WID_BT_TREELINE_PANE)->SetDisplayedPlane(SZSP_HORIZONTAL);
|
||||
}
|
||||
|
||||
this->FinishInitNested(window_number);
|
||||
}
|
||||
|
||||
|
@ -162,6 +168,15 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void SetStringParameters(WidgetID widget) const override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_BT_TREELINE_VALUE:
|
||||
SetDParam(0, _settings_game.game_creation.tree_line_height);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, WidgetID widget) const override
|
||||
{
|
||||
if (widget >= WID_BT_TYPE_BUTTON_FIRST) {
|
||||
|
@ -202,6 +217,18 @@ public:
|
|||
this->UpdateMode();
|
||||
break;
|
||||
|
||||
case WID_BT_TREELINE_DECREASE:
|
||||
assert(_game_mode == GM_EDITOR);
|
||||
_settings_game.game_creation.tree_line_height = Clamp(_settings_game.game_creation.tree_line_height - 1, 0, 100);
|
||||
this->InvalidateData();
|
||||
break;
|
||||
|
||||
case WID_BT_TREELINE_INCREASE:
|
||||
assert(_game_mode == GM_EDITOR);
|
||||
_settings_game.game_creation.tree_line_height = Clamp(_settings_game.game_creation.tree_line_height + 1, 0, 100);
|
||||
this->InvalidateData();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (widget >= WID_BT_TYPE_BUTTON_FIRST) {
|
||||
const int index = widget - WID_BT_TYPE_BUTTON_FIRST;
|
||||
|
@ -304,6 +331,16 @@ static constexpr NWidgetPart _nested_build_trees_widgets[] = {
|
|||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BT_MODE_FOREST_LG), SetFill(1, 0), SetDataTip(STR_TREES_MODE_FOREST_LG_BUTTON, STR_TREES_MODE_FOREST_LG_TOOLTIP),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BT_MANY_RANDOM), SetDataTip(STR_TREES_RANDOM_TREES_BUTTON, STR_TREES_RANDOM_TREES_TOOLTIP),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BT_TREELINE_PANE),
|
||||
NWidget(NWID_HORIZONTAL), SetPadding(2), SetPIP(0, 1, 0),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BT_TREELINE_LABEL), SetDataTip(STR_BUILD_TREES_TREELINE_LABEL, STR_BUILD_TREES_TREELINE_TOOLTIP), SetFill(1, 1),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BT_TREELINE_VALUE), SetDataTip(STR_JUST_INT, STR_BUILD_TREES_TREELINE_TOOLTIP), SetTextStyle(TC_ORANGE), SetFill(1, 1),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_BT_TREELINE_DECREASE), SetMinimalSize(9, 12), SetDataTip(AWV_DECREASE, STR_BUILD_TREES_TREELINE_DECREASE_TOOLTIP),
|
||||
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_BT_TREELINE_INCREASE), SetMinimalSize(9, 12), SetDataTip(AWV_INCREASE, STR_BUILD_TREES_TREELINE_INCREASE_TOOLTIP),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
|
|
|
@ -18,6 +18,11 @@ enum BuildTreesWidgets : WidgetID {
|
|||
WID_BT_MODE_FOREST_SM, ///< Select small forest planting mode.
|
||||
WID_BT_MODE_FOREST_LG, ///< Select large forest planting mode.
|
||||
WID_BT_MANY_RANDOM, ///< Button to build many random trees.
|
||||
WID_BT_TREELINE_PANE, ///< Selection pane to show/hide the tree line height, only shown in subarctic climate.
|
||||
WID_BT_TREELINE_LABEL, ///< Label for the tree line title.
|
||||
WID_BT_TREELINE_VALUE, ///< Label for the tree line value.
|
||||
WID_BT_TREELINE_DECREASE, ///< Button to decrease the tree line height.
|
||||
WID_BT_TREELINE_INCREASE, ///< Button to increase the tree line height.
|
||||
WID_BT_TYPE_BUTTON_FIRST, ///< First tree type selection button. (This must be last in the enum.)
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue