summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-09-23 15:24:15 +0000
committerrubidium <rubidium@openttd.org>2008-09-23 15:24:15 +0000
commitf49d5057ee811da59d2fb57df9e67760aeac17d8 (patch)
tree5750d793f5ad84cfe126c7054b76cb5950f64300 /src
parentd49381e5c9e3d22a4f85ebd725a8faf6d2ab9e5a (diff)
downloadopenttd-f49d5057ee811da59d2fb57df9e67760aeac17d8.tar.xz
(svn r14390) -Codechange: replace magic constants with symbolic constants.
Diffstat (limited to 'src')
-rw-r--r--src/cheat_gui.cpp2
-rw-r--r--src/genworld_gui.cpp8
-rw-r--r--src/industry_gui.cpp2
-rw-r--r--src/network/network_gui.cpp2
-rw-r--r--src/settings_gui.cpp8
-rw-r--r--src/station_gui.cpp2
-rw-r--r--src/toolbar_gui.cpp4
-rw-r--r--src/tree_gui.cpp2
-rw-r--r--src/window.cpp2
-rw-r--r--src/window_gui.h5
10 files changed, 19 insertions, 18 deletions
diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp
index 981a58970..fd0e90eeb 100644
--- a/src/cheat_gui.cpp
+++ b/src/cheat_gui.cpp
@@ -216,7 +216,7 @@ struct CheatWindow : Window {
if (value != oldvalue) WriteValue(ce->variable, ce->type, (int64)value);
- flags4 |= 5 << WF_TIMEOUT_SHL;
+ this->flags4 |= WF_TIMEOUT_BEGIN;
SetDirty();
}
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index caba3cf37..565a898c3 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -403,7 +403,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
case GLAND_START_DATE_DOWN:
case GLAND_START_DATE_UP: // Year buttons
/* Don't allow too fast scrolling */
- if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
+ if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
this->HandleButtonClick(widget);
this->SetDirty();
@@ -421,7 +421,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
case GLAND_SNOW_LEVEL_DOWN:
case GLAND_SNOW_LEVEL_UP: // Snow line buttons
/* Don't allow too fast scrolling */
- if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
+ if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
this->HandleButtonClick(widget);
this->SetDirty();
@@ -697,7 +697,7 @@ struct CreateScenarioWindow : public Window
case CSCEN_START_DATE_DOWN:
case CSCEN_START_DATE_UP: // Year buttons
/* Don't allow too fast scrolling */
- if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
+ if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
this->HandleButtonClick(widget);
this->SetDirty();
@@ -715,7 +715,7 @@ struct CreateScenarioWindow : public Window
case CSCEN_FLAT_LAND_HEIGHT_DOWN:
case CSCEN_FLAT_LAND_HEIGHT_UP: // Height level buttons
/* Don't allow too fast scrolling */
- if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
+ if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
this->HandleButtonClick(widget);
this->SetDirty();
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index b3420e3ea..e81b2ccfb 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -598,7 +598,7 @@ public:
UpdateIndustryProduction(i);
this->SetDirty();
- this->flags4 |= 5 << WF_TIMEOUT_SHL;
+ this->flags4 |= WF_TIMEOUT_BEGIN;
this->clicked_line = line + 1;
this->clicked_button = (x < 15 ? 1 : 2);
} else if (IsInsideMM(x, 34, 160)) {
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 5b8434424..2340bbd0b 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -855,7 +855,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU: // Click on up/down button for number of companies
case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU: // Click on up/down button for number of spectators
/* Don't allow too fast scrolling */
- if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
+ if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
this->HandleButtonClick(widget);
this->SetDirty();
switch (widget) {
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index aacfeebae..0220bb76b 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -890,8 +890,8 @@ struct PatchesSelectionWindow : Window {
uint32 step = (sdb->interval == 0) ? ((sdb->max - sdb->min) / 50) : sdb->interval;
if (step == 0) step = 1;
- // don't allow too fast scrolling
- if ((this->flags4 & WF_TIMEOUT_MASK) > 2 << WF_TIMEOUT_SHL) {
+ /* don't allow too fast scrolling */
+ if ((this->flags4 & WF_TIMEOUT_MASK) > WF_TIMEOUT_TRIGGER) {
_left_button_clicked = false;
return;
}
@@ -908,7 +908,7 @@ struct PatchesSelectionWindow : Window {
/* Set up scroller timeout for numeric values */
if (value != oldvalue && !(sd->desc.flags & SGF_MULTISTRING)) {
this->click = btn * 2 + 1 + ((x >= 10) ? 1 : 0);
- this->flags4 |= 5 << WF_TIMEOUT_SHL;
+ this->flags4 |= WF_TIMEOUT_BEGIN;
_left_button_clicked = false;
}
} break;
@@ -1168,7 +1168,7 @@ struct CustomCurrencyWindow : Window {
ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, this, afilter, QSF_NONE);
}
- this->flags4 |= 5 << WF_TIMEOUT_SHL;
+ this->flags4 |= WF_TIMEOUT_BEGIN;
this->SetDirty();
}
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 091cd6884..0bd274bf3 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -434,7 +434,7 @@ public:
case SLW_SORTBY: // flip sorting method asc/desc
this->stations.ToggleSortOrder();
- this->flags4 |= 5 << WF_TIMEOUT_SHL;
+ this->flags4 |= WF_TIMEOUT_BEGIN;
this->LowerWidget(SLW_SORTBY);
this->SetDirty();
break;
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 88b0ea17e..17622061f 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -747,7 +747,7 @@ static void ToolbarSwitchClick(Window *w)
static void ToolbarScenDateBackward(Window *w)
{
/* don't allow too fast scrolling */
- if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
+ if ((w->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
w->HandleButtonClick(TBSE_DATEBACKWARD);
w->SetDirty();
@@ -760,7 +760,7 @@ static void ToolbarScenDateBackward(Window *w)
static void ToolbarScenDateForward(Window *w)
{
/* don't allow too fast scrolling */
- if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
+ if ((w->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
w->HandleButtonClick(TBSE_DATEFORWARD);
w->SetDirty();
diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp
index 08ef815bf..460549c4d 100644
--- a/src/tree_gui.cpp
+++ b/src/tree_gui.cpp
@@ -111,7 +111,7 @@ public:
case BTW_MANY_RANDOM: // place trees randomly over the landscape
this->LowerWidget(BTW_MANY_RANDOM);
- this->flags4 |= 5 << WF_TIMEOUT_SHL;
+ this->flags4 |= WF_TIMEOUT_BEGIN;
SndPlayFx(SND_15_BEEP);
PlaceTreesRandomly();
MarkWholeScreenDirty();
diff --git a/src/window.cpp b/src/window.cpp
index 3686b0e14..2a46da55b 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -116,7 +116,7 @@ void Window::InvalidateWidget(byte widget_index) const
void Window::HandleButtonClick(byte widget)
{
this->LowerWidget(widget);
- this->flags4 |= 5 << WF_TIMEOUT_SHL;
+ this->flags4 |= WF_TIMEOUT_BEGIN;
this->InvalidateWidget(widget);
}
diff --git a/src/window_gui.h b/src/window_gui.h
index b615778c2..5de67feb5 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -487,8 +487,9 @@ enum WindowWidgetTypes {
* Window flags
*/
enum WindowFlags {
- WF_TIMEOUT_SHL = 0, ///< Window timeout counter shift
- WF_TIMEOUT_MASK = 7, ///< Window timeout counter bit mask (3 bits), @see WF_TIMEOUT_SHL
+ WF_TIMEOUT_TRIGGER = 2, ///< When the timeout should start triggering
+ WF_TIMEOUT_BEGIN = 5, ///< The initial value for the timeout
+ WF_TIMEOUT_MASK = 7, ///< Window timeout counter bit mask (3 bits)
WF_DRAGGING = 1 << 3, ///< Window is being dragged
WF_SCROLL_UP = 1 << 4, ///< Upper scroll button has been pressed, @see ScrollbarClickHandler()
WF_SCROLL_DOWN = 1 << 5, ///< Lower scroll button has been pressed, @see ScrollbarClickHandler()