Author: esr
Date: Fri Jun 22 14:46:50 2007
New Revision: 18378
URL: http://svn.gna.org/viewcvs/wesnoth?rev=18378&view=rev
Log:
Lift another bounds-checking function, and some cosmetic fixes.
Modified:
trunk/src/display.cpp
trunk/src/display.hpp
Modified: trunk/src/display.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=18378&r1=18377&r2=18378&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Fri Jun 22 14:46:50 2007
@@ -302,6 +302,14 @@
return gamemap::location(int((x - rect.x)/xdiv),int((y-rect.y)/ydiv));
}
+void map_display::get_visible_hex_bounds(gamemap::location &topleft,
gamemap::location &bottomright) const
+{
+ SDL_Rect r = map_area();
+ r.x=0;
+ r.y=0;
+ get_rect_hex_bounds(r, topleft, bottomright);
+}
+
void map_display::screenshot()
{
std::string datadir = get_screenshot_dir();
@@ -2129,14 +2137,6 @@
invalidate_route();
}
-void display::get_visible_hex_bounds(gamemap::location &topleft,
gamemap::location &bottomright) const
-{
- SDL_Rect r = map_area();
- r.x=0;
- r.y=0;
- get_rect_hex_bounds(r, topleft, bottomright);
-}
-
void display::remove_footstep(const gamemap::location& loc)
{
const std::vector<gamemap::location>::iterator it =
std::find(route_.steps.begin(),route_.steps.end(),loc);
Modified: trunk/src/display.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=18378&r1=18377&r2=18378&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Fri Jun 22 14:46:50 2007
@@ -129,6 +129,10 @@
int get_location_y(const gamemap::location& loc) const
{ return map_area().y + (loc.y + 1) * zoom_ - ypos_ +
(is_odd(loc.x) ? zoom_/2 : 0); }
+ //returns the locations of 2 hexes that bind the visible area
+ //of the map.
+ void get_visible_hex_bounds(gamemap::location &topleft,
gamemap::location &bottomright) const;
+
//function to make a screenshot and save it in a default location
void screenshot();
@@ -158,13 +162,14 @@
//the map. Used for special effects like flashes.
void adjust_colours(int r, int g, int b);
- //function which scrolls the display by xmov,ymov pixels. Invalidation
and
- //redrawing will be scheduled.
+ //function which scrolls the display by xmov,ymov
+ //pixels. Invalidation and redrawing will be scheduled.
void scroll(int xmov, int ymov);
- // Zooms the display by the specified amount. Negative values zoom out.
- // Note the amount should be a multiple of four otherwise the images
might
- // start to look odd. (hex_width() gets rounding errors)
+ // Zooms the display by the specified amount. Negative values
+ // zoom out. Note the amount should be a multiple of four
+ // otherwise the images might start to look odd. (hex_width()
+ // gets rounding errors)
void set_zoom(int amount);
// sets the zoom amount to the default.
@@ -182,15 +187,18 @@
//is not guaranteed.
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.
+
+ //scrolls to the leader of a certain side. This will normally
+ //be the playing team.
void scroll_to_leader(unit_map& units, int side);
//invalidates entire screen, including all tiles and sidebar.
void redraw_everything();
- //debug function to toggle the "sunset" mode
- //the map area become progressively darker except where hexes are
refreshed
- //delay it's the number of frames between each darkening (0 to toggle)
+ //debug function to toggle the "sunset" mode the map area
+ //become progressively darker except where hexes are refreshed
+ //delay it's the number of frames between each darkening (0 to
+ //toggle)
void sunset(const size_t delay = 0);
void flip();
@@ -200,17 +208,17 @@
//even if running behind.
void draw(bool update=true,bool force=false);
- //function to display a location as selected. If a unit is in the
location,
- //and there is no unit in the currently highlighted hex, the unit will
be
- //displayed in the sidebar.
+ //function to display a location as selected. If a unit is in
+ //the location, and there is no unit in the currently
+ //highlighted hex, the unit will be displayed in the sidebar.
void select_hex(gamemap::location hex);
const gamemap::location& selected_hex() { return selectedHex_; }
const gamemap::location& mouseover_hex() { return mouseoverHex_; }
- //function to highlight a location. If a unit is in the location, it
will
- //be displayed in the sidebar. Selection is used when a unit has been
- //clicked on, while highlighting is used when a location has been moused
- //over
+ //function to highlight a location. If a unit is in the
+ //location, it will be displayed in the sidebar. Selection is
+ //used when a unit has been clicked on, while highlighting is
+ //used when a location has been moused over
void highlight_hex(gamemap::location hex);
//sets the paths that are currently displayed as available for the unit
@@ -228,9 +236,6 @@
//unit. If NULL, no route is displayed.
//route does not have to remain valid after being set
void set_route(const paths::route* route);
-
- //returns the locations of 2 hexes that bind the visible area of the
map.
- void get_visible_hex_bounds(gamemap::location &topleft,
gamemap::location &bottomright) const;
//function to remove a footstep from a specific location
void remove_footstep(const gamemap::location& loc);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits