[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src unit_display.cpp
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src unit_display.cpp |
Date: |
Sat, 18 Sep 2004 07:33:25 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 04/09/18 11:22:51
Modified files:
src : unit_display.cpp
Log message:
Can a multiplication by zero (i/nsteps) be anything else than a bug?
Also remove the casts than unnecessarily clutter the code.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_display.cpp.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
Patches:
Index: wesnoth/src/unit_display.cpp
diff -u wesnoth/src/unit_display.cpp:1.33 wesnoth/src/unit_display.cpp:1.34
--- wesnoth/src/unit_display.cpp:1.33 Sat Sep 18 11:13:07 2004
+++ wesnoth/src/unit_display.cpp Sat Sep 18 11:22:51 2004
@@ -61,8 +61,8 @@
const gamemap::TERRAIN terrain = map.get_terrain(b);
const int nsteps = disp.turbo() ? 3 : 10*u.movement_cost(map,terrain);
- const double xstep = double(xdst - xsrc)/double(nsteps);
- const double ystep = double(ydst - ysrc)/double(nsteps);
+ const double xstep = double(xdst - xsrc) / nsteps;
+ const double ystep = double(ydst - ysrc) / nsteps;
const int time_between_frames = disp.turbo() ? 2 : 10;
int ticks = SDL_GetTicks();
@@ -96,8 +96,8 @@
xdst = disp.get_location_x(b);
ydst = disp.get_location_y(b);
- int xloc = xsrc + int(xstep*double(i));
- int yloc = ysrc + int(ystep*double(i));
+ int xloc = xsrc + int(xstep * i);
+ int yloc = ysrc + int(ystep * i);
//we try to scroll the map if the unit is at the edge.
//keep track of the old position, and if the map moves at all,
@@ -121,8 +121,8 @@
disp.draw_tile(src_adjacent[tile].x,
src_adjacent[tile].y);
}
- const int height_adjust = src_height_adjust +
(dst_height_adjust-src_height_adjust)*(i/nsteps);
- const double submerge = src_submerge +
(dst_submerge-src_submerge)*(double(i)/double(nsteps));
+ const int height_adjust = src_height_adjust +
(dst_height_adjust - src_height_adjust) * i / nsteps;
+ const double submerge = src_submerge + (dst_submerge -
src_submerge) * i / nsteps;
const int xpos = xloc;
const int ypos = yloc - height_adjust;
- [Wesnoth-cvs-commits] wesnoth/src unit_display.cpp, Guillaume Melquiond, 2004/09/12
- [Wesnoth-cvs-commits] wesnoth/src unit_display.cpp, Guillaume Melquiond, 2004/09/18
- [Wesnoth-cvs-commits] wesnoth/src unit_display.cpp, Guillaume Melquiond, 2004/09/18
- [Wesnoth-cvs-commits] wesnoth/src unit_display.cpp,
Guillaume Melquiond <=
- [Wesnoth-cvs-commits] wesnoth/src unit_display.cpp, Guillaume Melquiond, 2004/09/18
- [Wesnoth-cvs-commits] wesnoth/src unit_display.cpp, Guillaume Melquiond, 2004/09/18
- [Wesnoth-cvs-commits] wesnoth/src unit_display.cpp, Guillaume Melquiond, 2004/09/19