diff options
author | alberth <alberth@openttd.org> | 2011-01-16 11:39:09 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2011-01-16 11:39:09 +0000 |
commit | 1e7c3fd2ff156b635b6de62e2bb1b9ad9b70610b (patch) | |
tree | 6395cff5eebe25404d51cad115df9cefc250a8a6 | |
parent | a2297dc594cd7dde81a50282a281a84c55236b71 (diff) | |
download | openttd-1e7c3fd2ff156b635b6de62e2bb1b9ad9b70610b.tar.xz |
(svn r21820) -Codechange: Concatenate both functions.
-rw-r--r-- | src/window.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/window.cpp b/src/window.cpp index caa936cb3..88a0878f6 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1424,15 +1424,15 @@ static void HandlePlacePresize() } /** - * Handle dragging in mouse dragging mode (#WSM_DRAGDROP). + * Handle dragging and dropping in mouse dragging mode (#WSM_DRAGDROP). * @return State of handling the event. */ -static EventState HandleMouseDrag() +static EventState HandleMouseDragDrop() { Window *w; - if (_special_mouse_mode != WSM_DRAGDROP) return ES_NOT_HANDLED; - if (!_left_button_down || (_cursor.delta.x == 0 && _cursor.delta.y == 0)) return ES_NOT_HANDLED; + if (_special_mouse_mode != WSM_DRAGDROP) goto handle_dragdop; + if (!_left_button_down || (_cursor.delta.x == 0 && _cursor.delta.y == 0)) goto handle_dragdop; w = _thd.GetCallbackWnd(); @@ -1445,18 +1445,12 @@ static EventState HandleMouseDrag() } return ES_HANDLED; -} -/** - * Handle drop in mouse dragging mode (#WSM_DRAGDROP). - * @return State of handling the event. - */ -static EventState HandleDragDrop() -{ +handle_dragdop: if (_special_mouse_mode != WSM_DRAGDROP) return ES_NOT_HANDLED; if (_left_button_down) return ES_HANDLED; - Window *w = _thd.GetCallbackWnd(); + w = _thd.GetCallbackWnd(); if (w != NULL) { /* send an event in client coordinates. */ @@ -2178,8 +2172,7 @@ static void MouseLoop(MouseClick click, int mousewheel) UpdateTileSelection(); if (VpHandlePlaceSizingDrag() == ES_HANDLED) return; - if (HandleMouseDrag() == ES_HANDLED) return; - if (HandleDragDrop() == ES_HANDLED) return; + if (HandleMouseDragDrop() == ES_HANDLED) return; if (HandleWindowDragging() == ES_HANDLED) return; if (HandleScrollbarScrolling() == ES_HANDLED) return; if (HandleViewportScroll() == ES_HANDLED) return; |