void savegame::write_game_to_disk(const std::string& filename) { LOG_SAVE << "savegame::save_game" << std::endl; filename_ = filename; filename_ += compression::format_extension(compress_saves_); std::stringstream ss; { config_writer out(ss, compress_saves_); write_game(out); finish_save_game(out); } filesystem::scoped_ostream os(open_save_game(filename_)); (*os) << ss.str(); if (!os->good()) { throw game::save_game_failed(_("Could not write to file")); } }
void savegame::write_game_to_disk(const std::string& filename) { LOG_SAVE << "savegame::save_game"; filename_ = filename; if (compress_saves_) { filename_ += ".gz"; } std::stringstream ss; { config_writer out(ss, compress_saves_); write_game(out); finish_save_game(out); } scoped_ostream os(open_save_game(filename_)); (*os) << ss.str(); if (!os->good()) { throw game::save_game_failed(_("Could not write to file")); } }