Example #1
0
game_events::pump_result_t team::get_village(const map_location& loc, const int owner_side, game_data* gamedata)
{
	villages_.insert(loc);
	game_events::pump_result_t res;

	if(gamedata) {
		config::attribute_value& var = gamedata->get_variable("owner_side");
		const config::attribute_value old_value = var;
		var = owner_side;

		// During team building, game_events pump is not guaranteed to exist yet. (At current revision.) We skip capture
		// events in this case.
		if(resources::game_events) {
			res = resources::game_events->pump().fire("capture", loc);
		}

		if(old_value.blank()) {
			gamedata->clear_variable("owner_side");
		} else {
			var = old_value;
		}
	}

	return res;
}
Example #2
0
void unit_filter_compound::create_attribute(const config::attribute_value v, C conv, F func)
{
	if(v.empty()) {
	}
	else if(v.apply_visitor(contains_dollar_visitor())) {
		children_.emplace_back(new unit_filter_attribute_literal<C, F>(std::move(v.str()), std::move(conv), std::move(func)));
	}
	else {
		children_.emplace_back(new unit_filter_attribute_parsed<decltype(conv(v)), F>(std::move(conv(v)), std::move(func)));
	}
}
Example #3
0
void write_key_val(std::ostream &out, const std::string &key,
                   const config::attribute_value &value, unsigned level,
                   std::string& textdomain)
{
	value.apply_visitor(write_key_val_visitor(out, level, textdomain, key));
	out << '\n';
}
Example #4
0
void luaW_pushscalar(lua_State *L, config::attribute_value const &v)
{
	v.apply_visitor(luaW_pushscalar_visitor(L));
}