Skip to content

Commit

Permalink
Restored name= SUF with a fix to actually make it work
Browse files Browse the repository at this point in the history
  • Loading branch information
ln-zookeeper committed Mar 2, 2016
1 parent d9326e1 commit a695558
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/unit_filter.cpp
Expand Up @@ -116,12 +116,6 @@ 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 @@ -237,6 +231,10 @@ 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
{
if (!vcfg["name"].blank() && vcfg["name"].t_str() != u.name()) {
return false;
}

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 a695558

Please sign in to comment.