Skip to content

Commit

Permalink
Double-register the recruitment_instructions aspect under the name re…
Browse files Browse the repository at this point in the history
…cruitment.

This is now possible because the [value] tag in recruitment_instructions has become optional.
Thus, any valid old recruitment aspect is also a valid new recruitment_instructions aspect.
  • Loading branch information
CelticMinstrel authored and mattsc committed Mar 22, 2016
1 parent cde7041 commit e97026b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 1 addition & 7 deletions src/ai/configuration.cpp
Expand Up @@ -318,13 +318,7 @@ void configuration::expand_simplified_aspects(side_number side, config &cfg) {
facet_config["id"] = child.cfg["id"];
}
}
if (child.key == "recruitment") {
// This aspect is deprecated; transform it to a valid recruitment_instructions aspect
facet_config.child("value").add_child("recruit", config_of("importance", 0));
facet_configs.push_back(std::make_pair("recruitment_instructions", facet_config));
} else {
facet_configs.push_back(std::make_pair(child.key, facet_config));
}
facet_configs.push_back(std::make_pair(child.key, facet_config));
}
}
std::map<std::string, config> aspect_configs;
Expand Down
12 changes: 12 additions & 0 deletions src/ai/registry.cpp
Expand Up @@ -508,6 +508,18 @@ static register_lua_aspect_factory< lua_aspect<int> >
static register_lua_aspect_factory< lua_aspect< std::vector<std::string> > >
recruitment_pattern__lua_aspect_factory("recruitment_pattern*lua_aspect");


// Some compatibility - recruitment is a removed aspect, but its syntax
// is compatible with recruitment_instructions
static register_aspect_factory< composite_aspect<config> >
recruitments__composit_aspect_factory("recruitment*composite_aspect");

static register_aspect_factory< default_recruitment::recruitment_aspect >
recruitment__standard_aspect_factory("recruitment*standard_aspect");

static register_aspect_factory< default_recruitment::recruitment_aspect >
recruitment__standard_aspect_factory2("recruitment*");

void registry::init()
{
}
Expand Down

0 comments on commit e97026b

Please sign in to comment.