added some const modifiers,
need them for testing and the functions can be const anyway
This commit is contained in:
parent
c0c9a3eb26
commit
e06a318932
2 changed files with 12 additions and 4 deletions
|
@ -241,7 +241,9 @@ void display::highlight_hex(gamemap::location hex)
|
|||
}
|
||||
}
|
||||
|
||||
gamemap::location display::hex_clicked_on(int xclick, int yclick, gamemap::location::DIRECTION* nearest_hex, gamemap::location::DIRECTION* second_nearest_hex)
|
||||
const gamemap::location display::hex_clicked_on(int xclick, int yclick,
|
||||
gamemap::location::DIRECTION* nearest_hex,
|
||||
gamemap::location::DIRECTION* second_nearest_hex) const
|
||||
{
|
||||
const SDL_Rect& rect = map_area();
|
||||
if(point_in_rect(xclick,yclick,rect) == false) {
|
||||
|
@ -254,7 +256,9 @@ gamemap::location display::hex_clicked_on(int xclick, int yclick, gamemap::locat
|
|||
return pixel_position_to_hex(xpos_ + xclick, ypos_ + yclick, nearest_hex, second_nearest_hex);
|
||||
}
|
||||
|
||||
gamemap::location display::pixel_position_to_hex(int x, int y, gamemap::location::DIRECTION* nearest_hex, gamemap::location::DIRECTION* second_nearest_hex)
|
||||
const gamemap::location display::pixel_position_to_hex(int x, int y,
|
||||
gamemap::location::DIRECTION* nearest_hex,
|
||||
gamemap::location::DIRECTION* second_nearest_hex) const
|
||||
{
|
||||
const int s = hex_size();
|
||||
const int tesselation_x_size = hex_width() * 2;
|
||||
|
|
|
@ -157,12 +157,16 @@ public:
|
|||
//given x,y co-ordinates of an onscreen pixel, will return the
|
||||
//location of the hex that this pixel corresponds to. Returns an
|
||||
//invalid location is the mouse isn't over any valid location.
|
||||
gamemap::location hex_clicked_on(int x, int y, gamemap::location::DIRECTION* nearest_hex=NULL, gamemap::location::DIRECTION* second_nearest_hex=NULL);
|
||||
const gamemap::location hex_clicked_on(int x, int y,
|
||||
gamemap::location::DIRECTION* nearest_hex=NULL,
|
||||
gamemap::location::DIRECTION* second_nearest_hex=NULL) const;
|
||||
|
||||
//given x,y co-ordinates of a pixel on the map, will return the
|
||||
//location of the hex that this pixel corresponds to. Returns an
|
||||
//invalid location if the mouse isn't over any valid location.
|
||||
gamemap::location pixel_position_to_hex(int x, int y, gamemap::location::DIRECTION* nearest_hex=NULL, gamemap::location::DIRECTION* second_nearest_hex=NULL);
|
||||
const gamemap::location pixel_position_to_hex(int x, int y,
|
||||
gamemap::location::DIRECTION* nearest_hex=NULL,
|
||||
gamemap::location::DIRECTION* second_nearest_hex=NULL) const;
|
||||
|
||||
//given x,y co-ordinates of the mouse, will return the location of the
|
||||
//hex in the minimap that the mouse is currently over, or an invalid
|
||||
|
|
Loading…
Add table
Reference in a new issue