55 std::shared_ptr<save_index_class>
manager {};
105 return summary[
"replay"].to_bool() && !summary[
"snapshot"].to_bool(
true);
147 bool save_game_automatic(
bool ask_for_overwrite =
false,
const std::string&
filename =
"");
151 bool save_game_interactive(
const std::string& message,
152 DIALOG_TYPE dialog_type);
159 return create_filename(gamestate().get_starting_point()[
"turn_at"].to_int());
163 std::string create_filename(
unsigned int turn_number)
const;
170 bool save_game(
const std::string&
filename =
"");
173 bool check_filename(
const std::string&
filename);
178 const std::string&
title()
const {
return title_; }
204 virtual int show_save_dialog(
const std::string& message,
DIALOG_TYPE dialog_type);
206 bool check_overwrite();
210 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 abort a game, and to load another game instead.
load_game_exception(load_game_metadata &&data)
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
utils::optional< load_game_metadata > load_interactive_for_multiplayer()
bool is_replay_save(const config &summary)
void load_interactive_by_exception()
load_interactive wrapper for in-game save loading.
void set_gamestate(saved_game &gamestate, load_game_metadata &load_data)
utils::optional< load_game_metadata > load_interactive()
std::string filename
Filename.