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