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:
parent
0ccec6b7c5
commit
e5e582537c
1 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue