Skip to content

Commit

Permalink
Unit filters: move name warning to constructor and suggest alternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Feb 23, 2016
1 parent 3683490 commit fd939ce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/unit_filter.cpp
Expand Up @@ -116,6 +116,12 @@ class basic_unit_filter_impl : public unit_filter_abstract_impl {
, cond_children_()
, cond_child_types_()
{
// We don't support name= becasue it causes OOS since it depends on the translations
// It is for example possible that 2 units have the same name in one lanugage but not in another
// Also note that translations are currently broken in mp (see this http://gna.org/bugs/?22918 and related bugreports)
if (!vcfg["name"].empty()) {
ERR_CF << "'name' is not supported in standard unit filters - use 'id' or 'role' instead.\n";
}
// Handle [and], [or], and [not] with in-order precedence
vconfig::all_children_iterator cond = vcfg.ordered_begin();
vconfig::all_children_iterator cond_end = vcfg.ordered_end();
Expand Down Expand Up @@ -231,12 +237,6 @@ bool basic_unit_filter_impl::matches(const unit & u, const map_location& loc, co

bool basic_unit_filter_impl::internal_matches_filter(const unit & u, const map_location& loc) const
{
//We don't support name= becasue it casues oos since it depends on the translations
//It is for example possible that 2 units have the same name in one lanugage but not in aother
//Also note that translations are currently broken in mp (see this http://gna.org/bugs/?22918 and related bugreports)
if (!vcfg["name"].empty()) {
ERR_CF << "'name' is not supported in standart unit filters\n";
}
if (!vcfg["id"].empty()) {
std::vector<std::string> id_list = utils::split(vcfg["id"]);
if (std::find(id_list.begin(), id_list.end(), u.id()) == id_list.end()) {
Expand Down

0 comments on commit fd939ce

Please sign in to comment.