From e71033374c35f99614011bf375009cf4f95a53f2 Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Tue, 1 Jan 2019 01:37:16 +0100 Subject: [PATCH] fix apply_to=overlay effect previously [unit] overlays= would overwrite it, even when no overlays= is given. --- src/units/unit.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/units/unit.cpp b/src/units/unit.cpp index 992fafb4bdb2..729f4f94b9c6 100644 --- a/src/units/unit.cpp +++ b/src/units/unit.cpp @@ -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")) {