Author: mordante
Date: Sun May 27 10:51:40 2007
New Revision: 17896
URL: http://svn.gna.org/viewcvs/wesnoth?rev=17896&view=rev
Log:
changed scroll_to_tiles() to use gamemap::location
Modified:
trunk/src/ai.cpp
trunk/src/display.cpp
trunk/src/display.hpp
trunk/src/replay.cpp
trunk/src/unit_display.cpp
Modified: trunk/src/ai.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai.cpp?rev=17896&r1=17895&r2=17896&view=diff
==============================================================================
--- trunk/src/ai.cpp (original)
+++ trunk/src/ai.cpp Sun May 27 10:51:40 2007
@@ -484,7 +484,7 @@
if(show_move &&
unit_display::unit_visible_on_path(steps,
u_it->second,
info_.units,info_.teams)) {
-
info_.disp.scroll_to_tiles(from.x,from.y,to.x,to.y);
+ info_.disp.scroll_to_tiles(from,to);
unit_map::iterator up =
info_.units.find(u_it->first);
unit_display::move_unit(info_.map,steps,up->second,info_.teams);
Modified: trunk/src/display.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=17896&r1=17895&r2=17896&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Sun May 27 10:51:40 2007
@@ -633,10 +633,9 @@
}
}
-void display::scroll_to_tiles(int x1, int y1, int x2, int y2,
+void display::scroll_to_tiles(const gamemap::location& loc1, const
gamemap::location& loc2,
SCROLL_TYPE scroll_type, bool check_fogged)
{
- const gamemap::location loc1(x1,y1), loc2(x2,y2);
const int xpos1 = get_location_x(loc1);
const int ypos1 = get_location_y(loc1);
const int xpos2 = get_location_x(loc2);;
@@ -649,10 +648,10 @@
const int diffx = maxx - minx;
const int diffy = maxy - miny;
- // if rectangle formed by corners (x1,y1) and (x2,y2) is larger
- // than map area then just scroll to (x1,y1)
+ // if rectangle formed by corners loc1 and loc2 is larger
+ // than map area then just scroll to loc1
if(diffx > map_area().w || diffy > map_area().h) {
-
scroll_to_tile(gamemap::location(x1,y1),scroll_type,check_fogged);
+ scroll_to_tile(loc1,scroll_type,check_fogged);
} else {
// only scroll if rectangle is not completely inside map area
// assume most paths are within rectangle, sometimes
@@ -661,7 +660,7 @@
if (outside_area(map_area(),minx,miny) ||
outside_area(map_area(),maxx,maxy)) {
// scroll to middle point of rectangle
-
scroll_to_tile(gamemap::location((x1+x2)/2,(y1+y2)/2),scroll_type,check_fogged);
+
scroll_to_tile(gamemap::location((loc1.x+loc2.x)/2,(loc1.y+loc2.y)/2),scroll_type,check_fogged);
} // else don't scroll, rectangle is already on screen
}
}
Modified: trunk/src/display.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=17896&r1=17895&r2=17896&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Sun May 27 10:51:40 2007
@@ -105,9 +105,8 @@
//function which will scroll such that location x1,y1 is on-screen.
//it will also try to make it such that x2,y2 is on-screen but this
//is not guaranteed.
- void scroll_to_tiles(int x1, int y1, int x2, int y2,
+ void scroll_to_tiles(const gamemap::location& loc1, const
gamemap::location& loc2,
SCROLL_TYPE scroll_type=ONSCREEN, bool
check_fogged=true);
-
//scrolls to the leader of a certain side. This will normally be the
playing team.
void scroll_to_leader(unit_map& units, int side);
Modified: trunk/src/replay.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.cpp?rev=17896&r1=17895&r2=17896&view=diff
==============================================================================
--- trunk/src/replay.cpp (original)
+++ trunk/src/replay.cpp Sun May 27 10:51:40 2007
@@ -890,7 +890,7 @@
if(!replayer.is_skipping() &&
unit_display::unit_visible_on_path(rt->second.steps,u->second,units,teams)) {
- disp.scroll_to_tiles(src.x,src.y,dst.x,dst.y);
+ disp.scroll_to_tiles(src,dst);
}
if(!replayer.is_skipping()) {
Modified: trunk/src/unit_display.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_display.cpp?rev=17896&r1=17895&r2=17896&view=diff
==============================================================================
--- trunk/src/unit_display.cpp (original)
+++ trunk/src/unit_display.cpp Sun May 27 10:51:40 2007
@@ -84,7 +84,7 @@
const int total_mvt_time = 150 *
(int)(temp_unit.movement_cost(dst_terrain)/acceleration);
const unsigned int start_time = SDL_GetTicks();
int mvt_time = 1;
- disp->scroll_to_tiles(a.x,a.y,b.x,b.y,display::ONSCREEN);
+ disp->scroll_to_tiles(a,b,display::ONSCREEN);
while(mvt_time < total_mvt_time-1) { // one draw in each hex at least
disp->delay(10);
@@ -409,7 +409,7 @@
|| preferences::show_combat() == false;
if(!hide) {
- disp->scroll_to_tiles(a.x,a.y,b.x,b.y,display::ONSCREEN);
+ disp->scroll_to_tiles(a,b,display::ONSCREEN);
}
log_scope("unit_attack");
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits