void mp_options_helper::update_era_options()
{
	static const std::string type = "era";

	int pos = remove_nodes_for_type(type);

	display_custom_options(type, pos, create_engine_.curent_era_cfg());

	update_status_label();
}
void mp_options_helper::update_mod_options()
{
	static const std::string type = "modification";

	int pos = remove_nodes_for_type(type);

	for(const auto& mod : create_engine_.active_mods_data()) {
		display_custom_options(type, pos, *mod->cfg);
	}

	update_status_label();
}
Esempio n. 3
0
void tmp_create_game::update_options_list(twindow& window)
{
	ttree_view& options_tree = find_widget<ttree_view>(&window, "custom_options", false);

	// TODO: might be inefficient to regenerate this every single time this tab is selected
	// Maybe look into caching the result if no change has been made to the selection.
	visible_options_.clear();
	options_tree.clear();

	display_custom_options(options_tree,
		create_engine_.current_level_type() == ng::level::TYPE::CAMPAIGN ? "campaign" : "multiplayer",
		create_engine_.current_level().data()["id"], create_engine_.current_level().data());

	display_custom_options(options_tree, "era", create_engine_.curent_era_cfg()["id"], create_engine_.curent_era_cfg());

	std::set<std::string> activemods(create_engine_.active_mods().begin(), create_engine_.active_mods().end());
	for(const auto& mod : create_engine_.get_const_extras_by_type(ng::create_engine::MP_EXTRA::MOD)) {
		if (activemods.find(mod->id) != activemods.end()) {
			display_custom_options(options_tree, "modification", mod->id, *mod->cfg);
		}
	}
}
void mp_options_helper::update_game_options()
{
	std::string type;

	if(create_engine_.is_campaign()) {
		type = "campaign";
	} else {
		type = "multiplayer";
	}

	// For game options, we check for both types and remove them. This is to prevent options from a game
	// of one type remaining visible when selecting a game of another type.
	          remove_nodes_for_type("campaign");
	int pos = remove_nodes_for_type("multiplayer");

	display_custom_options(type, pos, create_engine_.current_level().data());

	update_status_label();
}