55 std::shared_ptr<save_index_class>
manager {};
129 return cfg[
"replay"].to_bool() && !cfg[
"snapshot"].to_bool(
true);
171 bool save_game_automatic(
bool ask_for_overwrite =
false,
const std::string&
filename =
"");
175 bool save_game_interactive(
const std::string& message,
176 DIALOG_TYPE dialog_type);
183 return create_filename(gamestate().get_starting_point()[
"turn_at"].to_int());
187 std::string create_filename(
unsigned int turn_number)
const;
194 bool save_game(
const std::string&
filename =
"");
197 bool check_filename(
const std::string&
filename);
202 const std::string&
title()
const {
return title_; }
228 virtual int show_save_dialog(
const std::string& message,
DIALOG_TYPE dialog_type);
230 bool check_overwrite();
234 void write_game_to_disk(
const std::string&
filename);
Class for writing a config out to a file in pieces.
A config object defines a single node in a WML file, with access to child nodes.
A class grating read only view to a vector of config objects, viewed as one config with all children ...
Base class for exceptions that want to be thrown 'through' lua.
void store() const noexcept
Stores a copy the current exception to be rethrown.
void autosave(const bool disable_autosave, const int autosave_max, const int infinite_autosaves)
autosave_savegame(saved_game &gamestate, const compression::format compress_saves)
virtual std::string create_initial_filename(unsigned int turn_number) const override
Create a filename for automatic saves.
Class for "normal" midgame saves.
ingame_savegame(saved_game &gamestate, const compression::format compress_saves)
void write_game(config_writer &out) override
Writing the savegame config to a file.
virtual std::string create_initial_filename(unsigned int turn_number) const override
Create a filename for automatic saves.
Exception used to signal that the user has decided to abortt a game, and to load another game instead...
load_game_exception(load_game_metadata &&data)
The class for loading a savefile.
void set_gamestate()
Generate the gamestate out of the loaded game config.
load_game_metadata & data()
void copy_era(config &cfg)
Copy era information into the snapshot.
bool check_version_compatibility()
Call check_version_compatibility above, using the version of this savefile.
bool load_game_ingame()
Load a game without providing any information.
loadgame(const std::shared_ptr< save_index_class > &index, saved_game &gamestate)
static bool is_replay_save(const config &cfg)
load_game_metadata load_data_
Primary output information.
bool load_multiplayer_game()
Loading a game from within the multiplayer-create dialog.
bool show_difficulty_dialog()
Display the difficulty dialog.
bool load_game()
Load a game with pre-setting information for the load-game dialog.
const game_config_view & game_config_
oos_savegame(saved_game &gamestate, bool &ignore)
virtual int show_save_dialog(const std::string &message, DIALOG_TYPE dialog_type) override
Display the save game dialog.
void set_title(const std::string &val)
Customize the dialog's caption.
Class for replay saves (either manually or automatically).
void write_game(config_writer &out) override
Writing the savegame config to a file.
virtual std::string create_initial_filename(unsigned int turn_number) const override
Create a filename for automatic saves.
replay_savegame(saved_game &gamestate, const compression::format compress_saves)
Filename and modification date for a file list.
std::string title_
Title of the savegame dialog.
std::string filename_
Filename of the savegame file on disk.
std::string create_filename() const
Build the filename according to the specific savegame's needs.
const std::string & title() const
bool show_confirmation_
Error message to be displayed if the savefile could not be generated.
std::string error_message_
const std::string & filename() const
std::shared_ptr< save_index_class > save_index_manager_
Will (at the time of writing) be save_index_class::default_saves_dir().
compression::format compress_saves_
Determines if a confirmation of successful saving the game is shown.
void set_error_message(const std::string &error_message)
Customize the standard error message.
virtual std::string create_initial_filename(unsigned int turn_number) const =0
Subclass-specific part of filename building.
const saved_game & gamestate() const
Class for start-of-scenario saves.
scenariostart_savegame(saved_game &gamestate, const compression::format compress_saves)
void write_game(config_writer &out) override
Writing the savegame config to a file.
virtual std::string create_initial_filename(unsigned int turn_number) const override
Create a filename for automatic saves.
Represents version numbers.
Definitions for the interface to Wesnoth Markup Language (WML).
Declarations for File-IO.
std::string label
What to show in the filter's drop-down list.
#define IMPLEMENT_LUA_JAILBREAK_EXCEPTION(type)
Helper macro for classes deriving from lua_jailbreak_exception.
std::unique_ptr< std::ostream > scoped_ostream
void clean_saves(const std::string &label)
Delete all autosaves of a certain scenario from the default save directory.
bool save_game_exists(std::string name, compression::format compressed)
Returns true if there is already a savegame with this name, looking only in the default save director...
void convert_old_saves(config &cfg)
converts saves from older versions of wesnoth
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
std::string filename
Filename.