Import remove all trees in scenario editor patch.
http://www.tt-forums.net/viewtopic.php?f=33&t=49326 Update to current current version. Use CMD_LANDSCAPE_CLEAR instead of CMD_CLEAR_AREA. Whitespace, misc fixes.
This commit is contained in:

committed by
Jonathan G Rennison

parent
2c9029703b
commit
2e04f211df
@@ -2819,6 +2819,8 @@ STR_TREES_RANDOM_TYPE :{BLACK}Trees of
|
|||||||
STR_TREES_RANDOM_TYPE_TOOLTIP :{BLACK}Place trees of random type. Shift toggles building/showing cost estimate
|
STR_TREES_RANDOM_TYPE_TOOLTIP :{BLACK}Place trees of random type. Shift toggles building/showing cost estimate
|
||||||
STR_TREES_RANDOM_TREES_BUTTON :{BLACK}Random Trees
|
STR_TREES_RANDOM_TREES_BUTTON :{BLACK}Random Trees
|
||||||
STR_TREES_RANDOM_TREES_TOOLTIP :{BLACK}Plant trees randomly throughout the landscape
|
STR_TREES_RANDOM_TREES_TOOLTIP :{BLACK}Plant trees randomly throughout the landscape
|
||||||
|
STR_TREES_REMOVE_TREES_BUTTON :{BLACK}Remove all Trees
|
||||||
|
STR_TREES_REMOVE_TREES_TOOLTIP :{BLACK}Remove all Trees over landscape
|
||||||
|
|
||||||
# Land generation window (SE)
|
# Land generation window (SE)
|
||||||
STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION :{WHITE}Land Generation
|
STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION :{WHITE}Land Generation
|
||||||
|
@@ -356,6 +356,24 @@ void PlaceTreesRandomly()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all trees
|
||||||
|
*
|
||||||
|
* This function remove all trees on the map.
|
||||||
|
*/
|
||||||
|
void RemoveAllTrees()
|
||||||
|
{
|
||||||
|
for(uint i = 0; i < MapSizeX(); i++) {
|
||||||
|
for(uint j = 0; j < MapSizeY(); j++) {
|
||||||
|
TileIndex tile = TileXY(i, j);
|
||||||
|
if(GetTileType(tile) == MP_TREES) {
|
||||||
|
DoCommandP(tile, 0, 0, CMD_LANDSCAPE_CLEAR | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Place new trees.
|
* Place new trees.
|
||||||
*
|
*
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
void PlaceTreesRandomly();
|
void PlaceTreesRandomly();
|
||||||
|
void RemoveAllTrees();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The build trees window.
|
* The build trees window.
|
||||||
@@ -120,6 +121,13 @@ public:
|
|||||||
PlaceTreesRandomly();
|
PlaceTreesRandomly();
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WID_BT_REMOVE_ALL: // remove all trees over the landscape
|
||||||
|
if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP);
|
||||||
|
RemoveAllTrees();
|
||||||
|
MarkWholeScreenDirty();
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,6 +221,8 @@ static const NWidgetPart _nested_build_trees_widgets[] = {
|
|||||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BT_TYPE_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TYPE, STR_TREES_RANDOM_TYPE_TOOLTIP),
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BT_TYPE_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TYPE, STR_TREES_RANDOM_TYPE_TOOLTIP),
|
||||||
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BT_MANY_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TREES_BUTTON, STR_TREES_RANDOM_TREES_TOOLTIP),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BT_MANY_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TREES_BUTTON, STR_TREES_RANDOM_TREES_TOOLTIP),
|
||||||
|
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
||||||
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BT_REMOVE_ALL), SetMinimalSize(139, 12), SetDataTip(STR_TREES_REMOVE_TREES_BUTTON, STR_TREES_REMOVE_TREES_TOOLTIP),
|
||||||
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
||||||
|
@@ -28,6 +28,7 @@ enum BuildTreesWidgets {
|
|||||||
WID_BT_TYPE_34, ///< Tree 3st column 4th row.
|
WID_BT_TYPE_34, ///< Tree 3st column 4th row.
|
||||||
WID_BT_TYPE_RANDOM, ///< Button to build random type of tree.
|
WID_BT_TYPE_RANDOM, ///< Button to build random type of tree.
|
||||||
WID_BT_MANY_RANDOM, ///< Button to build many random trees.
|
WID_BT_MANY_RANDOM, ///< Button to build many random trees.
|
||||||
|
WID_BT_REMOVE_ALL, ///< Button to remove all trees.
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* WIDGETS_TREE_WIDGET_H */
|
#endif /* WIDGETS_TREE_WIDGET_H */
|
||||||
|
Reference in New Issue
Block a user