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.
This commit is contained in:
Steve Cotton 2021-11-12 14:00:54 +01:00
parent 19a5ce83b1
commit 323ce6ec26

View file

@ -1062,7 +1062,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";
}
}