summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorplanetmaker <planetmaker@openttd.org>2011-12-16 16:57:15 +0000
committerplanetmaker <planetmaker@openttd.org>2011-12-16 16:57:15 +0000
commit5ade484ce4e7a92a0932a48d3cec1aca513d1282 (patch)
tree875e222afd13063e243ced3bbbea9950cf0753ab
parent219393ba5f4bb1588dbbf23490f31374bba10334 (diff)
downloadopenttd-5ade484ce4e7a92a0932a48d3cec1aca513d1282.tar.xz
(svn r23538) -Codechange: Consistent naming of widgets in tree plant gui
-rw-r--r--src/tree_gui.cpp58
-rw-r--r--src/widgets/tree_widget.h28
2 files changed, 43 insertions, 43 deletions
diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp
index 5429e716d..305b4b4d5 100644
--- a/src/tree_gui.cpp
+++ b/src/tree_gui.cpp
@@ -84,7 +84,7 @@ public:
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
- if (widget >= BTW_TYPE_11 && widget <= BTW_TYPE_34) {
+ if (widget >= WID_BT_TYPE_11 && widget <= WID_BT_TYPE_34) {
Dimension d = GetMaxTreeSpriteSize();
/* Allow some pixels extra width and height */
size->width = d.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
@@ -92,7 +92,7 @@ public:
return;
}
- if (widget != BTW_MANY_RANDOM) return;
+ if (widget != WID_BT_MANY_RANDOM) return;
if (_game_mode != GM_EDITOR) {
size->width = 0;
@@ -107,9 +107,9 @@ public:
virtual void DrawWidget(const Rect &r, int widget) const
{
- if (widget < BTW_TYPE_11 || widget > BTW_TYPE_34 || widget - BTW_TYPE_11 >= this->count) return;
+ if (widget < WID_BT_TYPE_11 || widget > WID_BT_TYPE_34 || widget - WID_BT_TYPE_11 >= this->count) return;
- int i = this->base + widget - BTW_TYPE_11;
+ int i = this->base + widget - WID_BT_TYPE_11;
/* Trees "grow" in the centre on the bottom line of the buttons */
DrawSprite(tree_sprites[i].sprite, tree_sprites[i].pal, (r.left + r.right) / 2 + WD_FRAMERECT_LEFT, r.bottom - 7);
}
@@ -117,24 +117,24 @@ public:
virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {
- case BTW_TYPE_11: case BTW_TYPE_12: case BTW_TYPE_13: case BTW_TYPE_14:
- case BTW_TYPE_21: case BTW_TYPE_22: case BTW_TYPE_23: case BTW_TYPE_24:
- case BTW_TYPE_31: case BTW_TYPE_32: case BTW_TYPE_33: case BTW_TYPE_34:
- if (widget - BTW_TYPE_11 >= this->count) break;
+ case WID_BT_TYPE_11: case WID_BT_TYPE_12: case WID_BT_TYPE_13: case WID_BT_TYPE_14:
+ case WID_BT_TYPE_21: case WID_BT_TYPE_22: case WID_BT_TYPE_23: case WID_BT_TYPE_24:
+ case WID_BT_TYPE_31: case WID_BT_TYPE_32: case WID_BT_TYPE_33: case WID_BT_TYPE_34:
+ if (widget - WID_BT_TYPE_11 >= this->count) break;
if (HandlePlacePushButton(this, widget, SPR_CURSOR_TREE, HT_RECT)) {
- this->tree_to_plant = (TreeType)(this->base + widget - BTW_TYPE_11);
+ this->tree_to_plant = (TreeType)(this->base + widget - WID_BT_TYPE_11);
}
break;
- case BTW_TYPE_RANDOM: // tree of random type.
- if (HandlePlacePushButton(this, BTW_TYPE_RANDOM, SPR_CURSOR_TREE, HT_RECT)) {
+ case WID_BT_TYPE_RANDOM: // tree of random type.
+ if (HandlePlacePushButton(this, WID_BT_TYPE_RANDOM, SPR_CURSOR_TREE, HT_RECT)) {
this->tree_to_plant = TREE_INVALID;
}
break;
- case BTW_MANY_RANDOM: // place trees randomly over the landscape
- this->LowerWidget(BTW_MANY_RANDOM);
+ case WID_BT_MANY_RANDOM: // place trees randomly over the landscape
+ this->LowerWidget(WID_BT_MANY_RANDOM);
this->SetTimeout();
SndPlayFx(SND_15_BEEP);
PlaceTreesRandomly();
@@ -173,8 +173,8 @@ public:
virtual void OnTimeout()
{
- this->RaiseWidget(BTW_MANY_RANDOM);
- this->SetWidgetDirty(BTW_MANY_RANDOM);
+ this->RaiseWidget(WID_BT_MANY_RANDOM);
+ this->SetWidgetDirty(WID_BT_MANY_RANDOM);
}
virtual void OnPlaceObjectAbort()
@@ -196,50 +196,50 @@ static const NWidgetPart _nested_build_trees_widgets[] = {
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_11), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_11), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_12), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_12), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_13), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_13), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_14), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_14), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_21), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_21), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_22), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_22), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_23), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_23), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_24), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_24), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_31), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_31), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_32), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_32), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_33), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_33), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_34), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_34), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP),
EndContainer(),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BTW_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(WWT_TEXTBTN, COLOUR_GREY, BTW_MANY_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TREES_BUTTON, STR_TREES_RANDOM_TREES_TOOLTIP),
+ NWidget(WWT_TEXTBTN, 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, 2),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
diff --git a/src/widgets/tree_widget.h b/src/widgets/tree_widget.h
index 7a1164f33..1672a4d61 100644
--- a/src/widgets/tree_widget.h
+++ b/src/widgets/tree_widget.h
@@ -14,20 +14,20 @@
/** Widgets of the WC_BUILD_TREES. */
enum BuildTreesWidgets {
- BTW_TYPE_11,
- BTW_TYPE_12,
- BTW_TYPE_13,
- BTW_TYPE_14,
- BTW_TYPE_21,
- BTW_TYPE_22,
- BTW_TYPE_23,
- BTW_TYPE_24,
- BTW_TYPE_31,
- BTW_TYPE_32,
- BTW_TYPE_33,
- BTW_TYPE_34,
- BTW_TYPE_RANDOM,
- BTW_MANY_RANDOM,
+ WID_BT_TYPE_11,
+ WID_BT_TYPE_12,
+ WID_BT_TYPE_13,
+ WID_BT_TYPE_14,
+ WID_BT_TYPE_21,
+ WID_BT_TYPE_22,
+ WID_BT_TYPE_23,
+ WID_BT_TYPE_24,
+ WID_BT_TYPE_31,
+ WID_BT_TYPE_32,
+ WID_BT_TYPE_33,
+ WID_BT_TYPE_34,
+ WID_BT_TYPE_RANDOM,
+ WID_BT_MANY_RANDOM,
};
#endif /* WIDGETS_TREE_WIDGET_H */