mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-16 10:20:30 +00:00
Merge pull request #223 from gfgtdf/unit_advancements
don't ignore [advancement] on unit construction.
This commit is contained in:
commit
e47e66e672
10
src/unit.cpp
10
src/unit.cpp
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user