Merge pull request #223 from gfgtdf/unit_advancements

don't ignore [advancement] on unit construction.
This commit is contained in:
gfgtdf 2014-06-25 15:55:36 +02:00
commit e47e66e672

View File

@ -40,6 +40,8 @@
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/function_output_iterator.hpp>
#include <boost/range/algorithm.hpp>
static lg::log_domain log_unit("unit");
#define DBG_UT LOG_STREAM(debug, log_unit)
@ -411,6 +413,14 @@ unit::unit(const config &cfg, bool use_traits, const vconfig* vcfg) :
} while(++cfg_range.first != cfg_range.second);
}
//If cfg specifies [advancement]s, replace this [advancement]s with them.
if(cfg.has_child("advancement"))
{
cfg_.clear_children("advancement");
boost::copy( cfg.child_range("advancement")
, boost::make_function_output_iterator(boost::bind( &config::add_child, boost::ref(cfg_) /*thisptr*/, "advancement", _1 )) );
}
//don't use the unit_type's abilities if this config has its own defined
cfg_range = cfg.child_range("abilities");
if(cfg_range.first != cfg_range.second) {