Screen no longer scrolls to enemy unit if they are under fog of war
This commit is contained in:
parent
23118885b7
commit
07016cd93c
3 changed files with 8 additions and 10 deletions
|
@ -314,11 +314,9 @@ void display::default_zoom()
|
|||
zoom(DefaultZoom - zoom_);
|
||||
}
|
||||
|
||||
void display::scroll_to_tile(int x, int y, SCROLL_TYPE scroll_type)
|
||||
void display::scroll_to_tile(int x, int y, SCROLL_TYPE scroll_type, bool check_fogged)
|
||||
{
|
||||
// allow to scroll to fogged tiles
|
||||
// if(update_locked() || fogged(x,y))
|
||||
if(update_locked())
|
||||
if(update_locked() || (check_fogged && fogged(x,y)))
|
||||
return;
|
||||
|
||||
if(map_.on_board(gamemap::location(x,y)) == false)
|
||||
|
@ -369,7 +367,7 @@ void display::scroll_to_tile(int x, int y, SCROLL_TYPE scroll_type)
|
|||
}
|
||||
|
||||
void display::scroll_to_tiles(int x1, int y1, int x2, int y2,
|
||||
SCROLL_TYPE scroll_type)
|
||||
SCROLL_TYPE scroll_type, bool check_fogged)
|
||||
{
|
||||
const double xpos1 = static_cast<double>(x1)*zoom_*0.75 - xpos_;
|
||||
const double ypos1 = static_cast<double>(y1)*zoom_ - ypos_ +
|
||||
|
@ -382,9 +380,9 @@ void display::scroll_to_tiles(int x1, int y1, int x2, int y2,
|
|||
const double diffy = fabs(ypos1 - ypos2);
|
||||
|
||||
if(diffx > map_area().w/(zoom_*0.75) || diffy > map_area().h/zoom_) {
|
||||
scroll_to_tile(x1,y1,scroll_type);
|
||||
scroll_to_tile(x1,y1,scroll_type,check_fogged);
|
||||
} else {
|
||||
scroll_to_tile((x1+x2)/2,(y1+y2)/2,scroll_type);
|
||||
scroll_to_tile((x1+x2)/2,(y1+y2)/2,scroll_type,check_fogged);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,13 +87,13 @@ public:
|
|||
enum SCROLL_TYPE { SCROLL, WARP };
|
||||
|
||||
//function which will scroll such that location x,y is on-screen.
|
||||
void scroll_to_tile(int x, int y, SCROLL_TYPE scroll_type=SCROLL);
|
||||
void scroll_to_tile(int x, int y, SCROLL_TYPE scroll_type=SCROLL, bool check_fogged=true);
|
||||
|
||||
//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,
|
||||
SCROLL_TYPE scroll_type=SCROLL);
|
||||
SCROLL_TYPE scroll_type=SCROLL, bool check_fogged=true);
|
||||
|
||||
//invalidates entire screen, including all tiles and sidebar.
|
||||
void redraw_everything();
|
||||
|
|
|
@ -377,7 +377,7 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
|
|||
|
||||
const gamemap::location& loc = gui_.minimap_location_on(event.x,event.y);
|
||||
if(loc.valid()) {
|
||||
gui_.scroll_to_tile(loc.x,loc.y,display::WARP);
|
||||
gui_.scroll_to_tile(loc.x,loc.y,display::WARP,false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue