From 76907870dcfd4db52489e0bbeadd1056745ed4ac Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Tue, 10 Jun 2014 09:46:13 -0400 Subject: [PATCH] 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. --- src/display.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/display.hpp b/src/display.hpp index e31d4a00f379..9c2139ffa40e 100644 --- a/src/display.hpp +++ b/src/display.hpp @@ -96,7 +96,7 @@ class display * 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 (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 @@ class display protected: //TODO sort - unit_map* units_; + const unit_map* units_; typedef std::map exclusive_unit_draw_requests_t; /// map of hexes where only one unit should be drawn, the one identified by the associated id string