Implement FR #10145 : new [variable] contains= condition

...to check the presence of a substring in the value of a variable
This commit is contained in:
Benoît Timbert 2007-10-15 19:11:50 +00:00
parent 3001d58ca0
commit 6b1db17430
2 changed files with 7 additions and 0 deletions

View file

@ -6,6 +6,9 @@ Version 1.3.9+svn:
* updated translations: Danish, Galician, Polish, Swedish
* multiplayer:
* revised maps: Silverhead Crossing, Weldyn Channel, Blue Water Province
* WML engine:
* new key "contains=" in [variable] conditions to check the presence of a
substring in a variable value
* miscellaneous and bug fixes:
Version 1.3.9:

View file

@ -255,6 +255,10 @@ bool internal_conditional_passed(const unit_map* units,
&& (utils::string_bool(value) != utils::string_bool(boolean_equals))) {
return false;
}
const std::string contains = values["contains"];
if(values.get_attribute("contains") != "" && value.find(contains) == std::string::npos) {
return false;
}
}
return true;
}