Basic support for the "add_to_" syntax...

...used to modify attributes of merged wml configs.

Currently only works for integer values.
This commit is contained in:
Fabian Müller 2012-05-06 11:52:02 +00:00
parent 0ccec6b7c5
commit e5e582537c

View file

@ -625,7 +625,13 @@ void config::merge_attributes(const config &cfg)
assert(this != &cfg);
foreach (const attribute &v, cfg.values) {
values[v.first] = v.second;
std::string key = v.first;
if (key.substr(0,7) == "add_to_") {
std::string add_to = key.substr(7,key.length());
values[add_to] = values[add_to].to_int() + v.second.to_int();
} else
values[v.first] = v.second;
}
}