diff --git a/src/display.cpp b/src/display.cpp index ad18925a179..ec6f1c90548 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -3056,7 +3056,7 @@ void display::invalidate_animations() } } } - const std::deque & unit_list = fake_unit_man_->get_fake_unit_list_for_invalidation(); + fake_unit_manager::range unit_list = fake_unit_man_->get_unit_range(); BOOST_FOREACH(const unit & u, dc_->units()) { u.anim_comp().refresh(); diff --git a/src/fake_unit_manager.hpp b/src/fake_unit_manager.hpp index ff8deb97c9b..eee3f17e31b 100644 --- a/src/fake_unit_manager.hpp +++ b/src/fake_unit_manager.hpp @@ -17,6 +17,8 @@ #include +#include + class display; class unit; class fake_unit; @@ -28,7 +30,10 @@ public: //Anticipate making place_temporary_unit and remove_temporary_unit private to force exception safety friend class fake_unit; - const std::deque & get_fake_unit_list_for_invalidation() {return fake_units_; } + typedef unit* internal_ptr_type; + typedef boost::iterator_range::const_iterator> range; + + range get_unit_range() const { return boost::make_iterator_range(fake_units_.begin(), fake_units_.end()); } private: /** Temporarily place a unit on map (moving: can overlap others). @@ -36,15 +41,15 @@ private: * and therefore gets drawn last, over other units and temp units. * Adding the same unit twice isn't allowed. */ - void place_temporary_unit(unit *u); + void place_temporary_unit(internal_ptr_type); /** Removes any instances of this temporary unit from the temporary unit vector. * Returns the number of temp units deleted (0 or 1, any other number indicates an error). */ - int remove_temporary_unit(unit *u); + int remove_temporary_unit(internal_ptr_type); /// collection of units destined to be drawn but not put into the unit map - std::deque fake_units_; + std::deque fake_units_; display & my_display_; }; diff --git a/src/game_display.cpp b/src/game_display.cpp index d97aac1f11c..bcc1a89be68 100644 --- a/src/game_display.cpp +++ b/src/game_display.cpp @@ -246,7 +246,7 @@ void game_display::draw_invalidated() halo::unrender(invalidated_); display::draw_invalidated(); - BOOST_FOREACH(const unit* temp_unit, fake_unit_man_->get_fake_unit_list_for_invalidation()) { + BOOST_FOREACH(const unit* temp_unit, fake_unit_man_->get_unit_range()) { 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()