fix apply_to=overlay effect

previously [unit] overlays= would overwrite it, even when no overlays= is given.
This commit is contained in:
gfgtdf 2019-01-01 01:37:16 +01:00 committed by GitHub
parent eb65c9b2ce
commit e71033374c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -511,9 +511,11 @@ void unit::init(const config& cfg, bool use_traits, const vconfig* vcfg)
// Apply the unit type's data to this unit.
advance_to(*type_, use_traits);
overlays_ = utils::parenthetical_split(cfg["overlays"], ',');
if(overlays_.size() == 1 && overlays_.front().empty()) {
overlays_.clear();
if(const config::attribute_value* v = cfg.get("overlays")) {
overlays_ = utils::parenthetical_split(v->str(), ',');
if(overlays_.size() == 1 && overlays_.front().empty()) {
overlays_.clear();
}
}
if(const config& variables = cfg.child("variables")) {