Fix matching of list types with limits
This commit is contained in:
parent
65ef12466d
commit
6e2ed5f53f
2 changed files with 10 additions and 13 deletions
|
@ -53,23 +53,19 @@
|
|||
name="defeat_condition"
|
||||
value="no_leader_left|no_units_left|never|always"
|
||||
[/type]
|
||||
[type]
|
||||
name=range
|
||||
[list]
|
||||
split="-"
|
||||
min=1
|
||||
max=2
|
||||
[element]
|
||||
link="int"
|
||||
[/element]
|
||||
[/list]
|
||||
[/type]
|
||||
[type]
|
||||
name=range_list
|
||||
# value="\d+(-\d+)?(,\d+(-\d+)?)*"
|
||||
[list]
|
||||
[element]
|
||||
link="range"
|
||||
[list]
|
||||
split="-"
|
||||
min=1
|
||||
max=2
|
||||
[element]
|
||||
link="int"
|
||||
[/element]
|
||||
[/list]
|
||||
[/element]
|
||||
[/list]
|
||||
[/type]
|
||||
|
|
|
@ -114,8 +114,9 @@ bool class_type_intersection::matches(const std::string& value, const map& type_
|
|||
bool class_type_list::matches(const std::string& value, const map& type_map) const
|
||||
{
|
||||
boost::sregex_token_iterator it(value.begin(), value.end(), split_, -1), end;
|
||||
int n = !value.empty();
|
||||
int n = 0;
|
||||
bool result = std::all_of(it, end, [this, &type_map, &n](const boost::ssub_match& match){
|
||||
// Not sure if this is necessary?
|
||||
if(!match.matched) return true;
|
||||
n++;
|
||||
return this->class_type_union::matches(std::string(match.first, match.second), type_map);
|
||||
|
|
Loading…
Add table
Reference in a new issue