Show id in "skipping duplicate variation" warning

Add a useful identifier to the message

    error config: Skipping duplicate unit variation ID: ''

This warning is generally shown because the variation_id is completely
missing, and so the message appeared as above, without any hint of which
unit was causing the problem.

In contrast to 19a5ce83's warning, this one is printed multiple times to
stdout even if the messages are identical; therefore backporting this to
1.16 seems reasonable.

(cherry picked from commit 323ce6ec26)
This commit is contained in:
Steve Cotton 2021-11-12 14:00:54 +01:00 committed by Steve Cotton
parent 0932ac6661
commit a9322e2f23
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
### Miscellaneous and Bug Fixes
* Make the log messages about "Skipping duplicate unit variation ID" say which `[unit_type]` is causing the error.

View file

@ -1061,7 +1061,8 @@ void unit_type::fill_variations()
bool success;
std::tie(ut, success) = variations_.emplace(var_cfg["variation_id"].str(), std::move(*var));
if(!success) {
ERR_CF << "Skipping duplicate unit variation ID: " << var_cfg["variation_id"] << "\n";
ERR_CF << "Skipping duplicate unit variation ID: '" << var_cfg["variation_id"]
<< "' of unit_type '" << get_cfg()["id"] << "'\n";
}
}