#include "filesystem.hpp"
#include "random.hpp"
#include "team.hpp"
#include "unit.hpp"
#include "variable.hpp"
#include <time.h>
#include <string>
#include <vector>
Go to the source code of this file.
Classes | |
struct | time_of_day |
Object which defines the current time of day. More... | |
struct | wml_menu_item |
struct | player_info |
Information on a particular player of the game. More... | |
class | game_state |
class | gamestatus |
Contains the global status of the game. More... | |
struct | gamestatus::area_time_of_day |
struct | save_info |
Holds all the data needed to start a scenario. More... | |
Enumerations | |
enum | WRITE_GAME_MODE { WRITE_SNAPSHOT_ONLY, WRITE_FULL_GAME } |
Functions | |
std::string | generate_game_uuid () |
std::vector< save_info > | get_saves_list (const std::string *dir=NULL, const std::string *filter=NULL) |
Get a list of available saves. | |
void | read_save_file (const std::string &name, config &cfg, std::string *error_log) |
void | write_game (const game_state &gamestate, config &cfg, WRITE_GAME_MODE mode=WRITE_FULL_GAME) |
void | write_game (config_writer &out, const game_state &gamestate, WRITE_GAME_MODE mode=WRITE_FULL_GAME) |
bool | save_game_exists (const std::string &name) |
Returns true iff there is already a savegame with that name. | |
scoped_ostream | open_save_game (const std::string &label) |
Throws game::save_game_failed. | |
void | finish_save_game (config_writer &out, const game_state &gamestate, const std::string &label) |
void | load_game (const std::string &name, game_state &gamestate, std::string *error_log) |
Load/Save games. | |
void | load_game_summary (const std::string &name, config &cfg_summary, std::string *error_log) |
void | save_game (const game_state &gamestate) |
Throws gamestatus::save_game_failed. | |
void | delete_game (const std::string &name) |
Delete a savegame. | |
config & | save_summary (const std::string &save) |
void | write_save_index () |
void | replace_underbar2space (std::string &name) |
Definition in file gamestatus.hpp.
enum WRITE_GAME_MODE |
void delete_game | ( | const std::string & | name | ) |
Delete a savegame.
Definition at line 764 of file gamestatus.cpp.
References get_saves_dir(), and replace_space2underbar().
Referenced by clean_saves(), and remove_old_auto_saves().
void finish_save_game | ( | config_writer & | out, | |
const game_state & | gamestate, | |||
const std::string & | label | |||
) |
Definition at line 846 of file gamestatus.cpp.
References _, extract_summary_data_from_save(), file_create_time(), get_saves_dir(), config_writer::good(), save_summary(), str_cast(), io_exception::what(), and write_save_index().
Referenced by replay::save_game(), and save_game().
std::string generate_game_uuid | ( | ) |
std::vector<save_info> get_saves_list | ( | const std::string * | dir = NULL , |
|
const std::string * | filter = NULL | |||
) |
Get a list of available saves.
Definition at line 727 of file gamestatus.cpp.
References file_create_time(), get_files_in_dir(), get_saves_dir(), and replace_underbar2space().
Referenced by clean_saves(), dialogs::load_game_dialog(), and remove_old_auto_saves().
void load_game | ( | const std::string & | name, | |
game_state & | gamestate, | |||
std::string * | error_log | |||
) |
Load/Save games.
Definition at line 813 of file gamestatus.cpp.
References cfg, copy_era(), game_state::game_state(), log_scope, and read_save_file().
void load_game_summary | ( | const std::string & | name, | |
config & | cfg_summary, | |||
std::string * | error_log | |||
) |
Definition at line 824 of file gamestatus.cpp.
References cfg, extract_summary_from_config(), log_scope, and read_save_file().
scoped_ostream open_save_game | ( | const std::string & | label | ) |
Throws game::save_game_failed.
Definition at line 834 of file gamestatus.cpp.
References get_saves_dir(), ostream_file(), replace_space2underbar(), and io_exception::what().
Referenced by replay::save_game(), and save_game().
void read_save_file | ( | const std::string & | name, | |
config & | cfg, | |||
std::string * | error_log | |||
) |
Definition at line 773 of file gamestatus.cpp.
References config::clear(), detect_format_and_read(), config::empty(), lg::err, get_saves_dir(), is_gzip_file(), istream_file(), config::error::message, read_gz(), and replace_space2underbar().
Referenced by load_game(), and load_game_summary().
void replace_underbar2space | ( | std::string & | name | ) |
Definition at line 112 of file gamestatus.cpp.
Referenced by get_saves_list(), and dialogs::show_objectives().
void save_game | ( | const game_state & | gamestate | ) |
Throws gamestatus::save_game_failed.
Definition at line 868 of file gamestatus.cpp.
References preferences::compress_saves(), finish_save_game(), game_state::label, open_save_game(), PACKAGE, and write_game().
Referenced by play_game().
bool save_game_exists | ( | const std::string & | name | ) |
Returns true iff there is already a savegame with that name.
Definition at line 752 of file gamestatus.cpp.
References preferences::compress_saves(), file_exists(), get_saves_dir(), and replace_space2underbar().
Referenced by play_controller::expand_autosaves(), and dialogs::get_save_name().
config& save_summary | ( | const std::string & | save | ) |
Definition at line 905 of file gamestatus.cpp.
References config::add_child(), cfg, config::find_child(), and save_index().
Referenced by finish_save_game(), and dialogs::load_game_dialog().
void write_game | ( | config_writer & | out, | |
const game_state & | gamestate, | |||
WRITE_GAME_MODE | mode = WRITE_FULL_GAME | |||
) |
Definition at line 647 of file gamestatus.cpp.
References game_state::abbrev, game_state::campaign, game_state::campaign_define, game_state::campaign_type, game_state::campaign_xtra_defines, config::child(), config_writer::close_child(), game_state::completion, game_state::difficulty, simple_rng::get_random_calls(), simple_rng::get_random_seed(), game_state::get_variables(), game_state::history, utils::join(), game_state::label, log_scope, game_state::next_scenario, config_writer::open_child(), game_state::players, game_state::replay_data, game_state::rng(), game_state::scenario, game_state::snapshot, game_state::starting_pos, game_config::version, game_state::wml_menu_items, config_writer::write_child(), WRITE_FULL_GAME, config_writer::write_key_val(), write_player(), and statistics::write_stats().
void write_game | ( | const game_state & | gamestate, | |
config & | cfg, | |||
WRITE_GAME_MODE | mode | |||
) |
Definition at line 585 of file gamestatus.cpp.
References game_state::abbrev, config::add_child(), game_state::campaign, game_state::campaign_define, game_state::campaign_type, game_state::campaign_xtra_defines, config::child(), game_state::completion, game_state::difficulty, simple_rng::get_random_calls(), simple_rng::get_random_seed(), game_state::get_variables(), game_state::history, utils::join(), game_state::label, lexical_cast(), log_scope, game_state::next_scenario, game_state::players, game_state::replay_data, game_state::rng(), game_state::scenario, game_state::snapshot, game_state::starting_pos, game_config::version, game_state::wml_menu_items, WRITE_FULL_GAME, write_player(), and statistics::write_stats().
Referenced by play_game(), replay::save_game(), save_game(), and events::menu_handler::write_game_snapshot().
void write_save_index | ( | ) |
Definition at line 917 of file gamestatus.cpp.
References get_save_index_file(), log_scope, ostream_file(), save_index(), stream, io_exception::what(), and write_compressed().
Referenced by finish_save_game(), and dialogs::load_game_dialog().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |