Author: alink
Date: Mon May 11 20:03:30 2009
New Revision: 35570
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35570&view=rev
Log:
Add a 'damage' key for [effect] applying to attack.
Support standard ranges like '1-10,20-30,42'
Modified:
trunk/src/unit_types.cpp
Modified: trunk/src/unit_types.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_types.cpp?rev=35570&r1=35569&r2=35570&view=diff
==============================================================================
--- trunk/src/unit_types.cpp (original)
+++ trunk/src/unit_types.cpp Mon May 11 20:03:30 2009
@@ -101,12 +101,17 @@
bool attack_type::matches_filter(const config& cfg,bool self) const
{
const std::vector<std::string>& filter_range =
utils::split(cfg["range"]);
+ const std::string& filter_damage = cfg["damage"];
const std::vector<std::string> filter_name = utils::split(cfg["name"]);
const std::vector<std::string> filter_type = utils::split(cfg["type"]);
const std::string filter_special = cfg["special"];
if(filter_range.empty() == false &&
std::find(filter_range.begin(),filter_range.end(),range()) ==
filter_range.end())
return false;
+
+ if(filter_damage.empty() == false && !in_ranges(damage(),
utils::parse_ranges(filter_damage))) {
+ return false;
+ }
if(filter_name.empty() == false &&
std::find(filter_name.begin(),filter_name.end(),id()) == filter_name.end())
return false;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits