Mercurial > hg > openttd
changeset 15468:fb3a6c7e621a draft
(svn r20117) -Codechange: Use a Point struct to store double click position.
author | terkhen <terkhen@openttd.org> |
---|---|
date | Sun, 11 Jul 2010 10:50:47 +0000 |
parents | cfc3beb1cf80 |
children | 29c84170912b |
files | src/window.cpp |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/window.cpp +++ b/src/window.cpp @@ -2188,21 +2188,19 @@ assert(IsGeneratingWorld() || _local_company == _current_company); static int double_click_time = 0; - static int double_click_x = 0; - static int double_click_y = 0; + static Point double_click_pos = {0, 0}; /* Mouse event? */ MouseClick click = MC_NONE; if (_left_button_down && !_left_button_clicked) { click = MC_LEFT; if (double_click_time != 0 && _realtime_tick - double_click_time < TIME_BETWEEN_DOUBLE_CLICK && - double_click_x != 0 && abs(_cursor.pos.x - double_click_x) < MAX_OFFSET_DOUBLE_CLICK && - double_click_y != 0 && abs(_cursor.pos.y - double_click_y) < MAX_OFFSET_DOUBLE_CLICK) { + double_click_pos.x != 0 && abs(_cursor.pos.x - double_click_pos.x) < MAX_OFFSET_DOUBLE_CLICK && + double_click_pos.y != 0 && abs(_cursor.pos.y - double_click_pos.y) < MAX_OFFSET_DOUBLE_CLICK) { click = MC_DOUBLE_LEFT; } double_click_time = _realtime_tick; - double_click_x = _cursor.pos.x; - double_click_y = _cursor.pos.y; + double_click_pos = _cursor.pos; _left_button_clicked = true; _input_events_this_tick++; } else if (_right_button_clicked) {