Enable special= in all weapon filters...

...(they were skipped in filters that determine if a weapon special is
active).

In addition to more WML flexibility, this allows a function parameter
to be eliminated.
This commit is contained in:
J. Tyne 2012-09-21 22:57:35 +00:00
parent 63b90f8732
commit eae8a7dc95
4 changed files with 7 additions and 7 deletions

View file

@ -2487,7 +2487,7 @@ void unit::add_modification(const std::string& type, const config& mod, bool no_
} else if(apply_to == "remove_attacks") {
std::vector<attack_type>::iterator a = attacks_.begin();
while(a != attacks_.end()) {
if(a->matches_filter(effect, false)) {
if(a->matches_filter(effect)) {
a = attacks_.erase(a);
continue;
}

View file

@ -667,7 +667,7 @@ namespace { // Helpers for attack_type::special_active()
// Check for a weapon match.
if ( const config & filter_weapon = filter_child.child("filter_weapon") ) {
if ( !weapon || !weapon->matches_filter(filter_weapon, true) )
if ( !weapon || !weapon->matches_filter(filter_weapon) )
return false;
}

View file

@ -95,7 +95,7 @@ std::string attack_type::accuracy_parry_description() const
* If @a ignore_special is set to true, then the special= attribute of the
* filter is ignored.
*/
bool attack_type::matches_filter(const config& filter, bool ignore_special) const
bool attack_type::matches_filter(const config& filter) const
{
const std::vector<std::string>& filter_range = utils::split(filter["range"]);
const std::string& filter_damage = filter["damage"];
@ -116,7 +116,7 @@ bool attack_type::matches_filter(const config& filter, bool ignore_special) cons
if(filter_type.empty() == false && std::find(filter_type.begin(),filter_type.end(),type()) == filter_type.end())
return false;
if ( !ignore_special && !filter_special.empty() && !get_special_bool(filter_special, true) )
if ( !filter_special.empty() && !get_special_bool(filter_special, true) )
return false;
return true;
@ -134,7 +134,7 @@ bool attack_type::matches_filter(const config& filter, bool ignore_special) cons
*/
bool attack_type::apply_modification(const config& cfg,std::string* description)
{
if(!matches_filter(cfg,0))
if( !matches_filter(cfg) )
return false;
const std::string& set_name = cfg["set_name"];
@ -272,7 +272,7 @@ bool attack_type::apply_modification(const config& cfg,std::string* description)
*/
bool attack_type::describe_modification(const config& cfg,std::string* description)
{
if(!matches_filter(cfg,0))
if( !matches_filter(cfg) )
return false;
const std::string& increase_damage = cfg["increase_damage"];

View file

@ -60,7 +60,7 @@ public:
// In unit_types.cpp:
bool matches_filter(const config& filter, bool ignore_special=false) const;
bool matches_filter(const config& filter) const;
bool apply_modification(const config& cfg,std::string* description);
bool describe_modification(const config& cfg,std::string* description);