Display: remove scroll_to_tiles overload taking iterators
Was only used in two places, one of which was as the implementation of the version that took a vector. All the same arguments were accepted by both. Also use list initialization for the other overloads.
This commit is contained in:
parent
bc971b45c9
commit
ea1d915c26
3 changed files with 9 additions and 26 deletions
|
@ -2019,23 +2019,17 @@ void display::scroll_to_tile(const map_location& loc, SCROLL_TYPE scroll_type, b
|
|||
return;
|
||||
}
|
||||
|
||||
std::vector<map_location> locs;
|
||||
locs.push_back(loc);
|
||||
scroll_to_tiles(locs, scroll_type, check_fogged,false,0.0,force);
|
||||
scroll_to_tiles({loc}, scroll_type, check_fogged, false, 0.0, force);
|
||||
}
|
||||
|
||||
void display::scroll_to_tiles(map_location loc1, map_location loc2,
|
||||
SCROLL_TYPE scroll_type, bool check_fogged,
|
||||
double add_spacing, bool force)
|
||||
{
|
||||
std::vector<map_location> locs;
|
||||
locs.push_back(loc1);
|
||||
locs.push_back(loc2);
|
||||
scroll_to_tiles(locs, scroll_type, check_fogged, false, add_spacing,force);
|
||||
scroll_to_tiles({loc1, loc2}, scroll_type, check_fogged, false, add_spacing, force);
|
||||
}
|
||||
|
||||
void display::scroll_to_tiles(const std::vector<map_location>::const_iterator & begin,
|
||||
const std::vector<map_location>::const_iterator & end,
|
||||
void display::scroll_to_tiles(const std::vector<map_location>& locs,
|
||||
SCROLL_TYPE scroll_type, bool check_fogged,
|
||||
bool only_if_possible, double add_spacing, bool force)
|
||||
{
|
||||
|
@ -2046,11 +2040,11 @@ void display::scroll_to_tiles(const std::vector<map_location>::const_iterator &
|
|||
int maxy = 0;
|
||||
bool valid = false;
|
||||
|
||||
for(std::vector<map_location>::const_iterator itor = begin; itor != end ; ++itor) {
|
||||
if(get_map().on_board(*itor) == false) continue;
|
||||
if(check_fogged && fogged(*itor)) continue;
|
||||
for(const map_location& loc : locs) {
|
||||
if(get_map().on_board(loc) == false) continue;
|
||||
if(check_fogged && fogged(loc)) continue;
|
||||
|
||||
const auto [x, y] = get_location(*itor);
|
||||
const auto [x, y] = get_location(loc);
|
||||
|
||||
if (!valid) {
|
||||
minx = x;
|
||||
|
|
|
@ -523,20 +523,10 @@ public:
|
|||
double add_spacing=0.0, bool force=true);
|
||||
|
||||
/** Scroll to fit as many locations on-screen as possible, starting with the first. */
|
||||
void scroll_to_tiles(const std::vector<map_location>::const_iterator & begin,
|
||||
const std::vector<map_location>::const_iterator & end,
|
||||
SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true,
|
||||
bool only_if_possible=false, double add_spacing=0.0,
|
||||
bool force=true);
|
||||
/** Scroll to fit as many locations on-screen as possible, starting with the first. */
|
||||
void scroll_to_tiles(const std::vector<map_location>& locs,
|
||||
SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true,
|
||||
bool only_if_possible=false,
|
||||
double add_spacing=0.0, bool force=true)
|
||||
{
|
||||
scroll_to_tiles(locs.begin(), locs.end(), scroll_type, check_fogged,
|
||||
only_if_possible, add_spacing, force);
|
||||
}
|
||||
double add_spacing=0.0, bool force=true);
|
||||
|
||||
/** Expose the event, so observers can be notified about map scrolling. */
|
||||
events::generic_event &scroll_event() const { return scroll_event_; }
|
||||
|
|
|
@ -720,9 +720,8 @@ bool editor_controller::do_execute_command(const hotkey::ui_command& cmd, bool p
|
|||
get_current_map_context().set_active_area(index);
|
||||
const std::set<map_location>& area =
|
||||
get_current_map_context().get_time_manager()->get_area_by_index(index);
|
||||
std::vector<map_location> locs(area.begin(), area.end());
|
||||
get_current_map_context().select_area(index);
|
||||
gui_->scroll_to_tiles(locs.begin(), locs.end());
|
||||
gui_->scroll_to_tiles({ area.begin(), area.end() });
|
||||
return true;
|
||||
}
|
||||
case ADDON:
|
||||
|
|
Loading…
Add table
Reference in a new issue