当前位置: 首页>>代码示例>>C++>>正文


C++ config::merge_with方法代码示例

本文整理汇总了C++中config::merge_with方法的典型用法代码示例。如果您正苦于以下问题:C++ config::merge_with方法的具体用法?C++ config::merge_with怎么用?C++ config::merge_with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config的用法示例。


在下文中一共展示了config::merge_with方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write

void game_state::write(config& cfg) const
{
	cfg["init_side_done"] = init_side_done_;
	if(gamedata_.phase() == game_data::PLAY) {
		cfg["playing_team"] = player_number_ - 1;
	}
	cfg["server_request_number"] = server_request_number_;
	//Call the lua save_game functions
	lua_kernel_->save_game(cfg);

	//Write the game events.
	events_manager_->write_events(cfg);

	//Write the map, unit_map, and teams info
	board_.write_config(cfg);

	//Write the tod manager, and time areas
	cfg.merge_with(tod_manager_.to_config());

	//write out the current state of the map
	cfg.merge_with(pathfind_manager_->to_config());

	//Write the game data, including wml vars
	gamedata_.write_snapshot(cfg);

	// Preserve the undo stack so that fog/shroud clearing is kept accurate.
	undo_stack_->write(cfg.add_child("undo_stack"));

	if(end_level_data_.get_ptr() != nullptr) {
		end_level_data_->write(cfg.add_child("end_level_data"));
	}
}
开发者ID:ArtBears,项目名称:wesnoth,代码行数:32,代码来源:game_state.cpp

示例2:

/**
 * Writes our data to a config, as a child if @a child_name is specified.
 * (No child is created if there is no data.)
 */
void movetype::resistances::write(config & out_cfg, const std::string & child_name) const
{
	if ( cfg_.empty() )
		return;

	if ( child_name.empty() )
		out_cfg.merge_with(cfg_);
	else
		out_cfg.add_child(child_name, cfg_);
}
开发者ID:ArtBears,项目名称:wesnoth,代码行数:14,代码来源:movetype.cpp

示例3: operator

	void operator()(config& child, const std::string& key, int startindex, int /*endindex*/) const
	{
		// The merge_with function only accepts configs so we convert vector -> config.
		config datatemp;

		// Add empty config to 'shift' the merge to startindex
		for(int index = 0; index < startindex; ++index) {
			datatemp.add_child(key);
		}

		// move datasource_ -> datatemp
		for(std::size_t index = 0; index < datasource_.size(); ++index) {
			datatemp.add_child(key).swap(datasource_[index]);
		}

		child.merge_with(datatemp);
	}
开发者ID:GregoryLundberg,项目名称:wesnoth,代码行数:17,代码来源:variable_info_private.hpp


注:本文中的config::merge_with方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。