Added a canrecruit filter (see patch #3640).

This commit is contained in:
Guillaume Melquiond 2005-01-22 12:14:07 +00:00
parent 8f4ed25e56
commit 5b7f1828d8
2 changed files with 5 additions and 0 deletions

View file

@ -88,6 +88,7 @@ CVS HEAD:
* added support for theme inheritance, to avoid duplicating mostly-unchanged
code
* added a "droid" game command, and allow for computer player to do a campaign
* added a "canrecruit" filter
* updated unix manpages
* "," is no longer the column separator, it does not have to be escaped
anymore in some translations, "=" is the new separator (#10368)

View file

@ -485,6 +485,7 @@ bool unit::matches_filter(const config& cfg) const
const std::string& role = cfg["role"];
const std::string& race = cfg["race"];
const std::string& gender = cfg["gender"];
const std::string& canrecruit = cfg["canrecruit"];
if(description.empty() == false && description != this->underlying_description()) {
return false;
@ -564,6 +565,9 @@ bool unit::matches_filter(const config& cfg) const
return false;
}
if (canrecruit.empty() == false && (canrecruit == "1") != can_recruit())
return false;
//if there are [not] tags below this tag, it means that the filter
//should not match if what is in the [not] tag does match
const config::child_list& negatives = cfg.get_children("not");