GUI2/Canvas: restored handling of immutable shapes (fixup 02858f2
)
This commit is contained in:
parent
02858f2259
commit
eecc46f02f
2 changed files with 12 additions and 5 deletions
|
@ -1485,9 +1485,16 @@ void canvas::parse_cfg(const config& cfg)
|
|||
}
|
||||
}
|
||||
|
||||
void canvas::clear_shapes()
|
||||
void canvas::clear_shapes(const bool force)
|
||||
{
|
||||
shapes_.clear();
|
||||
if(force) {
|
||||
shapes_.clear();
|
||||
} else {
|
||||
const auto conditional = [](const shape_ptr s)->bool { return !s->immutable(); };
|
||||
|
||||
auto iter = std::remove_if(shapes_.begin(), shapes_.end(), conditional);
|
||||
shapes_.erase(iter, shapes_.end());
|
||||
}
|
||||
}
|
||||
|
||||
void canvas::set_size(unsigned w, unsigned h)
|
||||
|
|
|
@ -120,9 +120,9 @@ public:
|
|||
* http://www.wesnoth.org/wiki/GUICanvasWML for
|
||||
* more information.
|
||||
*/
|
||||
void set_cfg(const config& cfg)
|
||||
void set_cfg(const config& cfg, const bool force = false)
|
||||
{
|
||||
clear_shapes();
|
||||
clear_shapes(force);
|
||||
parse_cfg(cfg);
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ private:
|
|||
*/
|
||||
void parse_cfg(const config& cfg);
|
||||
|
||||
void clear_shapes();
|
||||
void clear_shapes(const bool force);
|
||||
};
|
||||
|
||||
} // namespace gui2
|
||||
|
|
Loading…
Add table
Reference in a new issue