display object uses a const unit_map * internally

This was made possible because const units may now be drawn and
animated. There are some clients of the display object that still
call display::get_units, which is a non const getter, and which
we support by a const cast. The next step of refactor is to get
rid of that, but in this step we have at least gotten rid of all
internal uses of the non-const unit map.
This commit is contained in:
Chris Beck 2014-06-10 09:46:13 -04:00
parent 16db25b119
commit 76907870dc

View file

@ -96,7 +96,7 @@ public:
* Cancels all the exclusive draw requests.
*/
void clear_exclusive_draws() { exclusive_unit_draw_requests_.clear(); }
unit_map& get_units() {return *units_;}
unit_map& get_units() {return *const_cast<unit_map *> (units_);} //TODO: remove this when callers have been refactored not to require the non-const
const unit_map& get_const_units() const {return *units_;}
/**
@ -628,7 +628,7 @@ private:
protected:
//TODO sort
unit_map* units_;
const unit_map* units_;
typedef std::map<map_location, std::string> exclusive_unit_draw_requests_t;
/// map of hexes where only one unit should be drawn, the one identified by the associated id string