Author: alink
Date: Wed Apr 18 13:38:43 2007
New Revision: 16897
URL: http://svn.gna.org/viewcvs/wesnoth?rev=16897&view=rev
Log:
Revert the hack with abs(). This function is often used in the code
(even in this file), but I added a #include <cstdlib> just to be sure.
Modified:
trunk/src/mouse_events.cpp
Modified: trunk/src/mouse_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=16897&r1=16896&r2=16897&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Wed Apr 18 13:38:43 2007
@@ -26,6 +26,8 @@
#include "unit_abilities.hpp"
#include "wassert.hpp"
#include "wml_separators.hpp"
+
+#include <cstdlib>
#ifndef SDL_BUTTON_WHEELLEFT
#define SDL_BUTTON_WHEELLEFT 6
@@ -741,11 +743,7 @@
// While we check the mouse buttons state, we also grab fresh position
data.
int mx,my;
if (dragging_ && !dragging_started_ && (SDL_GetMouseState(&mx,&my) &
SDL_BUTTON(1) != 0)) {
- int abs1 = drag_from_x_- mx;
- int abs2 = drag_from_y_- my;
- abs1 = (abs1>0) ? abs1 : abs1 * -1;
- abs2 = (abs2>0) ? abs2 : abs2 * -1;
- const int drag_distance = maximum<int>(abs1, abs2);
+ const int drag_distance = maximum<int>(abs(drag_from_x_- mx),
abs(drag_from_y_- my));
if (drag_distance > 10) {
dragging_started_ = true;
cursor::set_dragging(true);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits