Skip to content

Commit

Permalink
don't ignore [advancement] on unit construction.
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Jun 25, 2014
1 parent e13775f commit 4bb214d
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, 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 4bb214d

Please sign in to comment.