Skip to content

Commit

Permalink
Fixed an error in [filter_special] encoding
Browse files Browse the repository at this point in the history
In special_id/type without the _'active' suffix only the encoding of the special in the attack is checked, and therefore the specials encoded in the [abilities] tags are de facto excluded, except that I forgot this logic in [filter_special] and I have to fix my error before updating the wikia.
  • Loading branch information
newfrenchy83 committed Nov 2, 2024
1 parent e52d69c commit d2d57bc
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/units/abilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2127,24 +2127,19 @@ bool attack_type::has_special_with_filter(const config & filter) const

bool attack_type::has_ability_with_filter(const config & filter) const
{
bool check_if_active = filter["active"].to_bool();
if(!filter["active"].to_bool()){
return false;
}
const unit_map& units = get_unit_map();
if(self_){
for(const auto [key, cfg] : (*self_).abilities().all_children_view()) {
if(self_->ability_matches_filter(cfg, key, filter)){
if(!check_if_active){
return true;
}
if(check_self_abilities(cfg, key)){
return true;
}
}
}

if(!check_if_active){
return false;
}

const auto adjacent = get_adjacent_tiles(self_loc_);
for(unsigned i = 0; i < adjacent.size(); ++i) {
const unit_map::const_iterator it = units.find(adjacent[i]);
Expand Down

0 comments on commit d2d57bc

Please sign in to comment.