make fake_unit_manager foreachable, drop the "range" getter

This commit is contained in:
Chris Beck 2014-06-23 12:45:46 -04:00
parent c1f3af2cbd
commit 4bb55f4ab8
3 changed files with 10 additions and 8 deletions

View File

@ -3081,12 +3081,11 @@ void display::invalidate_animations()
}
}
}
fake_unit_manager::range unit_list = fake_unit_man_->get_unit_range();
BOOST_FOREACH(const unit & u, dc_->units()) {
u.anim_comp().refresh();
}
BOOST_FOREACH(const unit* u, unit_list) {
BOOST_FOREACH(const unit* u, *fake_unit_man_) {
u->anim_comp().refresh();
}
@ -3096,7 +3095,7 @@ void display::invalidate_animations()
BOOST_FOREACH(const unit & u, dc_->units()) {
new_inval |= u.anim_comp().invalidate(*this);
}
BOOST_FOREACH(const unit* u, unit_list) {
BOOST_FOREACH(const unit* u, *fake_unit_man_) {
new_inval |= u->anim_comp().invalidate(*this);
}
}while(new_inval);

View File

@ -17,8 +17,6 @@
#include <deque>
#include <boost/range/iterator_range.hpp>
class display;
class unit;
class fake_unit_ptr;
@ -31,9 +29,14 @@ public:
friend class fake_unit_ptr;
typedef unit const * internal_ptr_type;
typedef boost::iterator_range<std::deque<internal_ptr_type>::const_iterator> range;
typedef std::deque<internal_ptr_type>::const_iterator iterator;
typedef std::deque<internal_ptr_type>::const_iterator const_iterator;
range get_unit_range() const { return boost::make_iterator_range(fake_units_.begin(), fake_units_.end()); }
iterator begin() { return fake_units_.begin(); }
iterator end() { return fake_units_.end(); }
const_iterator begin() const { return fake_units_.begin(); }
const_iterator end() const { return fake_units_.end(); }
private:
/** Temporarily place a unit on map (moving: can overlap others).

View File

@ -257,7 +257,7 @@ void game_display::draw_invalidated()
unit_drawer drawer = unit_drawer(*this);
BOOST_FOREACH(const unit* temp_unit, fake_unit_man_->get_unit_range()) {
BOOST_FOREACH(const unit* temp_unit, *fake_unit_man_) {
const map_location& loc = temp_unit->get_location();
exclusive_unit_draw_requests_t::iterator request = exclusive_unit_draw_requests_.find(loc);
if (invalidated_.find(loc) != invalidated_.end()