summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-07-11 10:50:47 +0000
committerterkhen <terkhen@openttd.org>2010-07-11 10:50:47 +0000
commitdd5bf70f2025e69007b9b8aaf3f62b7b40543f34 (patch)
treee21c95d32d34fe435f924b61fc056cb781c8b1b3
parent066aa61a458814f101e8ca5ec225d5f1c2f5c4ca (diff)
downloadopenttd-dd5bf70f2025e69007b9b8aaf3f62b7b40543f34.tar.xz
(svn r20117) -Codechange: Use a Point struct to store double click position.
-rw-r--r--src/window.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 2379f173b..2c12dbe8e 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2188,21 +2188,19 @@ void HandleMouseEvents()
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) {