(svn r24589) -Codechange: Return early in HandleAutoscroll() instead of nesting ifs.

This commit is contained in:
frosch 2012-10-13 08:34:10 +00:00
parent 9d877e888a
commit 2abe4ac280
1 changed files with 24 additions and 22 deletions

View File

@ -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,