mirror of https://github.com/OpenTTD/OpenTTD
(svn r24589) -Codechange: Return early in HandleAutoscroll() instead of nesting ifs.
parent
9d877e888a
commit
2abe4ac280
|
@ -2290,13 +2290,17 @@ static int _input_events_this_tick = 0;
|
||||||
*/
|
*/
|
||||||
static void HandleAutoscroll()
|
static void HandleAutoscroll()
|
||||||
{
|
{
|
||||||
if (_settings_client.gui.autoscroll && _game_mode != GM_MENU && !HasModalProgress()) {
|
if (_game_mode == GM_MENU || HasModalProgress()) return;
|
||||||
|
if (!_settings_client.gui.autoscroll) return;
|
||||||
|
|
||||||
int x = _cursor.pos.x;
|
int x = _cursor.pos.x;
|
||||||
int y = _cursor.pos.y;
|
int y = _cursor.pos.y;
|
||||||
Window *w = FindWindowFromPt(x, y);
|
Window *w = FindWindowFromPt(x, y);
|
||||||
if (w == NULL || w->flags & WF_DISABLE_VP_SCROLL) return;
|
if (w == NULL || w->flags & WF_DISABLE_VP_SCROLL) return;
|
||||||
|
|
||||||
ViewPort *vp = IsPtInWindowViewport(w, x, y);
|
ViewPort *vp = IsPtInWindowViewport(w, x, y);
|
||||||
if (vp != NULL) {
|
if (vp == NULL) return;
|
||||||
|
|
||||||
x -= vp->left;
|
x -= vp->left;
|
||||||
y -= vp->top;
|
y -= vp->top;
|
||||||
|
|
||||||
|
@ -2314,8 +2318,6 @@ static void HandleAutoscroll()
|
||||||
}
|
}
|
||||||
#undef scrollspeed
|
#undef scrollspeed
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum MouseClick {
|
enum MouseClick {
|
||||||
MC_NONE = 0,
|
MC_NONE = 0,
|
||||||
|
|
Loading…
Reference in New Issue