本文整理汇总了C++中config_writer类的典型用法代码示例。如果您正苦于以下问题:C++ config_writer类的具体用法?C++ config_writer怎么用?C++ config_writer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了config_writer类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: write_game
void replay_savegame::write_game(config_writer &out) {
savegame::write_game(out);
gamestate().write_carryover(out);
out.write_child("replay_start", gamestate().replay_start());
out.write_child("replay", gamestate().replay_data);
}
开发者ID:mrwillis21,项目名称:wesnoth,代码行数:8,代码来源:savegame.cpp
示例2: write_battle_result_map
static void write_battle_result_map(config_writer &out, const stats::battle_result_map& m)
{
for(stats::battle_result_map::const_iterator i = m.begin(); i != m.end(); ++i) {
out.open_child("sequence");
write_str_int_map(out, i->second);
out.write_key_val("_num", i->first);
out.close_child("sequence");
}
}
开发者ID:gaconkzk,项目名称:wesnoth,代码行数:9,代码来源:statistics.cpp
示例3: write_stats
void write_stats(config_writer &out)
{
out.write_key_val("mid_scenario", mid_scenario ? "yes" : "no");
for(std::vector<scenario_stats>::const_iterator i = master_stats.begin(); i != master_stats.end(); ++i) {
out.open_child("scenario");
i->write(out);
out.close_child("scenario");
}
}
开发者ID:gaconkzk,项目名称:wesnoth,代码行数:10,代码来源:statistics.cpp
示例4: write_game
void replay_savegame::write_game(config_writer &out) {
savegame::write_game(out);
gamestate().write_carryover(out);
out.write_child("replay_start", gamestate().replay_start());
out.open_child("replay");
gamestate().get_replay().write(out);
out.close_child("replay");
}
开发者ID:pax2you4now,项目名称:wesnoth,代码行数:11,代码来源:savegame.cpp
示例5: write_str_int_map
static void write_str_int_map(config_writer &out, const stats::str_int_map& m)
{
for(stats::str_int_map::const_iterator i = m.begin(); i != m.end(); ++i) {
char buf[50];
snprintf(buf,sizeof(buf),"%d",i->second);
out.write_key_val(i->first, buf);
}
}
开发者ID:hyrio,项目名称:War-Of-Kingdom,代码行数:8,代码来源:statistics.cpp
示例6: finish_save_game
void savegame::finish_save_game(const config_writer &out)
{
try {
if(!out.good()) {
throw game::save_game_failed(_("Could not write to file"));
}
save_index_manager.remove(gamestate_.classification().label);
} catch(filesystem::io_exception& e) {
throw game::save_game_failed(e.what());
}
}
开发者ID:pax2you4now,项目名称:wesnoth,代码行数:11,代码来源:savegame.cpp
示例7: write_config
void game_data::write_config(config_writer& out){
out.write_key_val("scenario", scenario_);
out.write_key_val("next_scenario", next_scenario_);
out.write_key_val("random_seed", lexical_cast<std::string>(rng_.get_random_seed()));
out.write_key_val("random_calls", lexical_cast<std::string>(rng_.get_random_calls()));
out.write_child("variables", variables_);
config cfg;
wml_menu_items_.to_config(cfg);
out.write_child("menu_item", cfg);
}
开发者ID:Kanac,项目名称:wesnoth,代码行数:12,代码来源:game_data.cpp
示例8: finish_save_game
void savegame::finish_save_game(const config_writer &out)
{
std::string name = gamestate_.classification().label;
replace_space2underbar(name);
std::string fname(get_saves_dir() + "/" + name);
try {
if(!out.good()) {
throw game::save_game_failed(_("Could not write to file"));
}
config& summary = save_index::save_summary(gamestate_.classification().label);
extract_summary_data_from_save(summary);
const int mod_time = static_cast<int>(file_create_time(fname));
summary["mod_time"] = str_cast(mod_time);
save_index::write_save_index();
} catch(io_exception& e) {
throw game::save_game_failed(e.what());
}
}
开发者ID:blackberry,项目名称:Wesnoth,代码行数:20,代码来源:savegame.cpp
示例9: write
void stats::write(config_writer &out) const
{
out.open_child("recruits");
write_str_int_map(out, recruits);
out.close_child("recruits");
out.open_child("recalls");
write_str_int_map(out, recalls);
out.close_child("recalls");
out.open_child("advances");
write_str_int_map(out, advanced_to);
out.close_child("advances");
out.open_child("deaths");
write_str_int_map(out, deaths);
out.close_child("deaths");
out.open_child("killed");
write_str_int_map(out, killed);
out.close_child("killed");
out.open_child("attacks");
write_battle_result_map(out, attacks);
out.close_child("attacks");
out.open_child("defends");
write_battle_result_map(out, defends);
out.close_child("defends");
out.write_key_val("recruit_cost", recruit_cost);
out.write_key_val("recall_cost", recall_cost);
out.write_key_val("damage_inflicted", damage_inflicted);
out.write_key_val("damage_taken", damage_taken);
out.write_key_val("expected_damage_inflicted", expected_damage_inflicted);
out.write_key_val("expected_damage_taken", expected_damage_taken);
out.write_key_val("turn_damage_inflicted", turn_damage_inflicted);
out.write_key_val("turn_damage_taken", turn_damage_taken);
out.write_key_val("turn_expected_damage_inflicted", turn_expected_damage_inflicted);
out.write_key_val("turn_expected_damage_taken", turn_expected_damage_taken);
out.write_key_val("save_id", save_id);
}
开发者ID:gaconkzk,项目名称:wesnoth,代码行数:39,代码来源:statistics.cpp
示例10: write_str_int_map
static void write_str_int_map(config_writer &out, const stats::str_int_map& m)
{
for(stats::str_int_map::const_iterator i = m.begin(); i != m.end(); ++i) {
out.write_key_val(i->first, i->second);
}
}
开发者ID:gaconkzk,项目名称:wesnoth,代码行数:6,代码来源:statistics.cpp
示例11: write
void stats::write(config_writer &out) const
{
out.open_child("recruits");
write_str_int_map(out, recruits);
out.close_child("recruits");
out.open_child("recalls");
write_str_int_map(out, recalls);
out.close_child("recalls");
out.open_child("advances");
write_str_int_map(out, advanced_to);
out.close_child("advances");
out.open_child("deaths");
write_str_int_map(out, deaths);
out.close_child("deaths");
out.open_child("killed");
write_str_int_map(out, killed);
out.close_child("killed");
out.open_child("attacks");
write_battle_result_map(out, attacks);
out.close_child("attacks");
out.open_child("defends");
write_battle_result_map(out, defends);
out.close_child("defends");
std::ostringstream ss;
ss << recruit_cost;
out.write_key_val("recruit_cost", ss.str());
ss.str(std::string());
ss << recall_cost;
out.write_key_val("recall_cost", ss.str());
ss.str(std::string());
ss << damage_inflicted;
out.write_key_val("damage_inflicted", ss.str());
ss.str(std::string());
ss << damage_taken;
out.write_key_val("damage_taken", ss.str());
ss.str(std::string());
ss << expected_damage_inflicted;
out.write_key_val("expected_damage_inflicted", ss.str());
ss.str(std::string());
ss << expected_damage_taken;
out.write_key_val("expected_damage_taken", ss.str());
ss.str(std::string());
ss << turn_damage_inflicted;
out.write_key_val("turn_damage_inflicted", ss.str());
ss.str(std::string());
ss << turn_damage_taken;
out.write_key_val("turn_damage_taken", ss.str());
ss.str(std::string());
ss << turn_expected_damage_inflicted;
out.write_key_val("turn_expected_damage_inflicted", ss.str());
ss.str(std::string());
ss << turn_expected_damage_taken;
out.write_key_val("turn_expected_damage_taken", ss.str());
out.write_key_val("save_id", save_id);
}
开发者ID:hyrio,项目名称:War-Of-Kingdom,代码行数:60,代码来源:statistics.cpp
示例12: write_game
void savegame::write_game(config_writer &out) const
{
config cfg = gamestate_.classification().to_config();
BOOST_FOREACH (const config::attribute& i, cfg.attribute_range()) {
out.write_key_val(i.first, i.second);
}
int duration = gamestate_.duration(time(NULL));
out.write_key_val("duration", lexical_cast<std::string>(duration));
out.write_key_val("random_seed", lexical_cast<std::string>(gamestate_.rng().get_random_seed()));
out.write_key_val("random_calls", lexical_cast<std::string>(gamestate_.rng().get_random_calls()));
// update newest rpg to variables
gamestate_.rpg_2_variable();
out.write_child("variables", gamestate_.get_variables());
for (std::map<std::string, wml_menu_item *>::const_iterator j=gamestate_.wml_menu_items.begin();
j!=gamestate_.wml_menu_items.end(); ++j) {
out.open_child("menu_item");
out.write_key_val("id", j->first);
out.write_key_val("image", j->second->image);
out.write_key_val("description", j->second->description);
out.write_key_val("needs_select", (j->second->needs_select) ? "yes" : "no");
if(!j->second->show_if.empty())
out.write_child("show_if", j->second->show_if);
if(!j->second->filter_location.empty())
out.write_child("filter_location", j->second->filter_location);
if(!j->second->command.empty())
out.write_child("command", j->second->command);
out.close_child("menu_item");
}
out.write_child("snapshot", snapshot_);
/*
out.open_child("statistics");
statistics::write_stats(out);
out.close_child("statistics");
*/
if (!gamestate_.replay_data_dbg.child("replay12")) {
out.write_child("replay12", gamestate_.replay_data_dbg);
}
}
开发者ID:freeors,项目名称:War-Of-Kingdom,代码行数:42,代码来源:savegame.cpp
注:本文中的config_writer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论