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


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

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


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

示例1:

gamemap::gamemap(const config& cfg, const config& level):
		tiles_(1),
		terrainList_(),
		tcodeToTerrain_(),
		villages_(),
		borderCache_(),
		terrainFrequencyCache_(),
		w_(-1),
		h_(-1),
		total_width_(0),
		total_height_(0),
		border_size_(gamemap::SINGLE_TILE_BORDER),
		usage_(IS_MAP)
{
	DBG_G << "loading map: '" << level.debug() << "'\n";
	const config::const_child_itors &terrains = cfg.child_range("terrain_type");
	create_terrain_maps(terrains, terrainList_, tcodeToTerrain_);

	const config& map_child = level.child_or_empty("map");

	if (map_child.empty()) {
		const std::string& map_data = level["map_data"];
		if (!map_data.empty()) {
			read(map_data);
		} else {
			w_ = 0;
			h_ = 0;
			total_width_ = 0;
			total_height_ = 0;
		}
	} else {
		read(map_child["data"], true, map_child["border_size"], map_child["usage"]);
	}
}
开发者ID:gaconkzk,项目名称:wesnoth,代码行数:34,代码来源:map.cpp

示例2:

gamemap::gamemap(const tdata_cache& tdata, const config& level):
		tiles_(1),
		tdata_(tdata),
		villages_(),
		borderCache_(),
		terrainFrequencyCache_(),
		w_(-1),
		h_(-1),
		total_width_(0),
		total_height_(0),
		border_size_(gamemap::default_border)
{
	DBG_G << "loading map: '" << level.debug() << "'\n";

	const config& map_child = level.child_or_empty("map");

	if (map_child.empty()) {
		const std::string& map_data = level["map_data"];
		if (!map_data.empty()) {
			read(map_data);
		} else {
			w_ = 0;
			h_ = 0;
			total_width_ = 0;
			total_height_ = 0;
		}
	} else {
		read(map_child["data"], true);
	}
}
开发者ID:Stewie23,项目名称:wesnoth,代码行数:30,代码来源:map.cpp

示例3: mapgen_exception

lua_map_generator::lua_map_generator(const config & cfg)
	: id_(cfg["id"])
	, config_name_(cfg["config_name"])
	, user_config_(cfg["user_config"])
	, create_map_(cfg["create_map"])
	, create_scenario_(cfg["create_scenario"])
	, lk_()
	, generator_data_(cfg)
{
	const char* required[] = {"id", "config_name", "create_map"};
	for (std::string req : required) {
		if (!cfg.has_attribute(req)) {
			std::string msg = "Error when constructing a lua map generator -- missing a required attribute '";
			msg += req + "'\n";
			msg += "Config was '" + cfg.debug() + "'";
			throw mapgen_exception(msg);
		}
	}
}
开发者ID:ArtBears,项目名称:wesnoth,代码行数:19,代码来源:lua_map_generator.cpp

示例4: process_network_data

turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg)
{
	// the simple wesnothserver implementation in wesnoth was removed years ago.
	assert(cfg.all_children_count() == 1);
	assert(cfg.attribute_range().first == cfg.attribute_range().second);
	if(!resources::recorder->at_end())
	{
		ERR_NW << "processing network data while still having data on the replay." << std::endl;
	}

	if (const config &msg = cfg.child("message"))
	{
		resources::screen->get_chat_manager().add_chat_message(time(nullptr), msg["sender"], msg["side"],
				msg["message"], events::chat_handler::MESSAGE_PUBLIC,
				preferences::message_bell());
	}
	else if (const config &msg = cfg.child("whisper") /*&& is_observer()*/)
	{
		resources::screen->get_chat_manager().add_chat_message(time(nullptr), "whisper: " + msg["sender"].str(), 0,
				msg["message"], events::chat_handler::MESSAGE_PRIVATE,
				preferences::message_bell());
	}
	else if (const config &ob = cfg.child("observer") )
	{
		resources::screen->get_chat_manager().add_observer(ob["name"]);
	}
	else if (const config &ob = cfg.child("observer_quit"))
	{
		resources::screen->get_chat_manager().remove_observer(ob["name"]);
	}
	else if (cfg.child("leave_game")) {
		throw ingame_wesnothd_error("");
	}
	else if (const config &turn = cfg.child("turn"))
	{
		return handle_turn(turn);
	}
	else if (cfg.has_child("whiteboard"))
	{
		resources::whiteboard->process_network_data(cfg);
	}
	else if (const config &change = cfg.child("change_controller"))
	{
		if(change.empty()) {
			ERR_NW << "Bad [change_controller] signal from server, [change_controller] tag was empty." << std::endl;
			return PROCESS_CONTINUE;
		}

		const int side = change["side"].to_int();
		const bool is_local = change["is_local"].to_bool();
		const std::string player = change["player"];
		const size_t index = side - 1;
		if(index >= resources::gameboard->teams().size()) {
			ERR_NW << "Bad [change_controller] signal from server, side out of bounds: " << change.debug() << std::endl;
			return PROCESS_CONTINUE;
		}

		const team & tm = resources::gameboard->teams().at(index);
		const bool was_local = tm.is_local();

		resources::gameboard->side_change_controller(side, is_local, player);

		if (!was_local && tm.is_local()) {
			resources::controller->on_not_observer();
		}

		if (resources::gameboard->is_observer() || (resources::gameboard->teams())[resources::screen->playing_team()].is_local_human()) {
			resources::screen->set_team(resources::screen->playing_team());
			resources::screen->redraw_everything();
			resources::screen->recalculate_minimap();
		} else if (tm.is_local_human()) {
			resources::screen->set_team(side - 1);
			resources::screen->redraw_everything();
			resources::screen->recalculate_minimap();
		}

		resources::whiteboard->on_change_controller(side,tm);

		resources::screen->labels().recalculate_labels();

		const bool restart = resources::screen->playing_side() == side && (was_local || tm.is_local());
		return restart ? PROCESS_RESTART_TURN : PROCESS_CONTINUE;
	}

	else if (const config &side_drop_c = cfg.child("side_drop"))
	{
		const int  side_drop = side_drop_c["side_num"].to_int(0);
		size_t index = side_drop -1;

		bool restart = side_drop == resources::screen->playing_side();

		if (index >= resources::teams->size()) {
			ERR_NW << "unknown side " << side_drop << " is dropping game" << std::endl;
			throw ingame_wesnothd_error("");
		}

		team::CONTROLLER ctrl;
		if(!ctrl.parse(side_drop_c["controller"])) {
			ERR_NW << "unknown controller type issued from server on side drop: " << side_drop_c["controller"] << std::endl;
			throw ingame_wesnothd_error("");
//.........这里部分代码省略.........
开发者ID:N4tr0n,项目名称:wesnoth,代码行数:101,代码来源:playturn.cpp

示例5: update_addon_requirements

void mp_game_settings::update_addon_requirements(const config & cfg) {
	if (cfg["id"].empty()) {
		WRN_NG << "Tried to add add-on metadata to a game, missing mandatory id field... skipping.\n" << cfg.debug() << "\n";
		return;
	}

	mp_game_settings::addon_version_info new_data(cfg);

	// Check if this add-on already has an entry as a dependency for this scenario. If so, try to reconcile their version info,
	// by taking the larger of the min versions. The version should be the same for all WML from the same add-on...
	std::map<std::string, addon_version_info>::iterator it = addons.find(cfg["id"].str());
	if (it != addons.end()) {
		addon_version_info & addon = it->second;

		if (new_data.version) {
			if (!addon.version || (*addon.version != *new_data.version)) {
				WRN_NG << "Addon version data mismatch -- not all local WML has same version of '" << cfg["id"].str() << "' addon.\n";
			}
		}
		if (addon.version && !new_data.version) {
			WRN_NG << "Addon version data mismatch -- not all local WML has same version of '" << cfg["id"].str() << "' addon.\n";
		}
		if (new_data.min_version) {
			if (!addon.min_version || (*new_data.min_version > *addon.min_version)) {
				addon.min_version = *new_data.min_version;
			}
		}
	} else {
		// Didn't find this addon-id in the map, so make a new entry.
		addons.insert(std::make_pair(cfg["id"].str(), new_data));
	}
}
开发者ID:PoignardAzur,项目名称:wesnoth,代码行数:32,代码来源:mp_game_settings.cpp


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