summaryrefslogtreecommitdiff
path: root/src/industry_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-06-01 14:41:09 +0000
committerfrosch <frosch@openttd.org>2012-06-01 14:41:09 +0000
commit056f779334baf1857686453a8b382daf079311de (patch)
treeb1aee9f3e86b072ac264e88e7be885a4b9fc64b7 /src/industry_gui.cpp
parent198de5397ed4a217273bda29dae8ddf60ba48f1d (diff)
downloadopenttd-056f779334baf1857686453a8b382daf079311de.tar.xz
(svn r24310) -Codechange: Add named constants for the dimensions of settings buttons, and generally make their usage more consistent.
Diffstat (limited to 'src/industry_gui.cpp')
-rw-r--r--src/industry_gui.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 8b182dbd9..5a180bef5 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -749,7 +749,7 @@ public:
SetDParam(1, i->last_month_production[j]);
SetDParamStr(2, cargo_suffix[j]);
SetDParam(3, ToPercent8(i->last_month_pct_transported[j]));
- uint x = left + WD_FRAMETEXT_LEFT + (this->editable == EA_RATE ? 30 : 0);
+ uint x = left + WD_FRAMETEXT_LEFT + (this->editable == EA_RATE ? SETTING_BUTTON_WIDTH + 10 : 0);
DrawString(x, right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_VIEW_TRANSPORTED);
/* Let's put out those buttons.. */
if (this->editable == EA_RATE) {
@@ -764,7 +764,7 @@ public:
y += WD_PAR_VSEP_WIDE;
this->production_offset_y = y;
SetDParam(0, RoundDivSU(i->prod_level * 100, PRODLEVEL_DEFAULT));
- uint x = left + WD_FRAMETEXT_LEFT + 30;
+ uint x = left + WD_FRAMETEXT_LEFT + SETTING_BUTTON_WIDTH + 10;
DrawString(x, right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_VIEW_PRODUCTION_LEVEL);
DrawArrowButtons(left + WD_FRAMETEXT_LEFT, y, COLOUR_YELLOW, (this->clicked_line == IL_MULTIPLIER) ? this->clicked_button : 0,
i->prod_level > PRODLEVEL_MINIMUM, i->prod_level < PRODLEVEL_MAXIMUM);
@@ -838,9 +838,9 @@ public:
NWidgetBase *nwi = this->GetWidget<NWidgetBase>(widget);
int left = nwi->pos_x + WD_FRAMETEXT_LEFT;
int right = nwi->pos_x + nwi->current_x - 1 - WD_FRAMERECT_RIGHT;
- if (IsInsideMM(pt.x, left, left + 20)) {
+ if (IsInsideMM(pt.x, left, left + SETTING_BUTTON_WIDTH)) {
/* Clicked buttons, decrease or increase production */
- byte button = (pt.x < left + 10) ? 1 : 2;
+ byte button = (pt.x < left + SETTING_BUTTON_WIDTH / 2) ? 1 : 2;
switch (this->editable) {
case EA_MULTIPLIER:
if (button == 1) {
@@ -872,7 +872,7 @@ public:
this->SetTimeout();
this->clicked_line = line;
this->clicked_button = button;
- } else if (IsInsideMM(pt.x, left + 30, right)) {
+ } else if (IsInsideMM(pt.x, left + SETTING_BUTTON_WIDTH + 10, right)) {
/* clicked the text */
this->editbox_line = line;
switch (this->editable) {