Author: sapient
Date: Wed Apr 18 08:02:54 2007
New Revision: 16886

URL: http://svn.gna.org/viewcvs/wesnoth?rev=16886&view=rev
Log:
not sure what the portable version of ::abs() is, so a quick workaround
(was giving me invalid memory access errors)

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=16886&r1=16885&r2=16886&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Wed Apr 18 08:02:54 2007
@@ -741,7 +741,11 @@
        // 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)) {
-               const int drag_distance = maximum<int>(abs(drag_from_x_- mx), 
abs(drag_from_y_- my));
+               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);
                if (drag_distance > 10) {
                        dragging_started_ = true;
                        cursor::set_dragging(true);


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to