Skip to content

Commit

Permalink
some change for type value and affect_allies
Browse files Browse the repository at this point in the history
  • Loading branch information
newfrenchy83 committed Oct 9, 2023
1 parent 7b742b4 commit 97e9568
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions data/schema/filters/abilities.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
{SIMPLE_KEY divide s_real_range_list}
{SIMPLE_KEY affect_adjacent s_bool}
{SIMPLE_KEY affect_self s_bool}
{DEFAULT_KEY affect_allies affect_allies_filter empty}
{SIMPLE_KEY affect_allies bool_or_empty}
{SIMPLE_KEY affect_enemies s_bool}
{DEFAULT_KEY type_value value_type empty}
{SIMPLE_KEY type_value value_type}
{FILTER_BOOLEAN_OPS abilities}
[/tag]
6 changes: 3 additions & 3 deletions data/schema/game_config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
[/type]
[type]
name="value_type"
value="|value|add|sub|multiply|divide"
value="value|add|sub|multiply|divide"
[/type]
[type]
name="affect_allies_filter"
value="empty|yes|no"
name="bool_or_empty"
value="no_used|yes|no|true|false"
[/type]
[type]
name="addon_type"
Expand Down
12 changes: 6 additions & 6 deletions src/units/unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1429,15 +1429,15 @@ static bool type_value_if_present(const config& filter, const config& cfg)

std::string cfg_type_value;
const std::vector<std::string> filter_attribute = utils::split(filter["type_value"]);
if(!cfg["value"].empty()){
if(cfg.has_attribute("value")){
cfg_type_value ="value";
} else if(!cfg["add"].empty()){
} else if(cfg.has_attribute("add")){
cfg_type_value ="add";
} else if(!cfg["sub"].empty()){
} else if(cfg.has_attribute("sub")){
cfg_type_value ="sub";
} else if(!cfg["multiply"].empty()){
} else if(cfg.has_attribute("multiply")){
cfg_type_value ="multiply";
} else if(!cfg["divide"].empty()){
} else if(cfg.has_attribute("divide")){
cfg_type_value ="divide";
}
return ( std::find(filter_attribute.begin(), filter_attribute.end(), cfg_type_value) != filter_attribute.end() );
Expand All @@ -1461,7 +1461,7 @@ static bool matches_ability_filter(const config & cfg, const std::string& tag_na
if(!bool_matches_if_present(filter, cfg, "affect_allies", true)){
return false;
}
} else if(!filter["affect_allies"].empty() && filter["affect_allies"].str() != "empty"){
} else if(!filter["affect_allies"].empty() && filter["affect_allies"].str() != "no_used"){
return false;
}

Expand Down

0 comments on commit 97e9568

Please sign in to comment.