mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-12 17:19:09 +00:00
(svn r14390) -Codechange: replace magic constants with symbolic constants.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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)) {
|
||||
|
@@ -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) {
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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()
|
||||
|
Reference in New Issue
Block a user