Skip to content

Commit

Permalink
Merge pull request #223 from gfgtdf/unit_advancements
Browse files Browse the repository at this point in the history
don't ignore [advancement] on unit construction.
  • Loading branch information
gfgtdf committed Jun 25, 2014
2 parents d895f7d + b49eed5 commit e47e66e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/unit.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e47e66e

Please sign in to comment.