The Battle for Wesnoth  1.15.7+dev
Macros | Functions | Variables
saved_game.cpp File Reference
#include "saved_game.hpp"
#include "carryover.hpp"
#include "config.hpp"
#include "cursor.hpp"
#include "formula/string_utils.hpp"
#include "game_config_manager.hpp"
#include "generators/map_create.hpp"
#include "log.hpp"
#include "random.hpp"
#include "serialization/binary_or_text.hpp"
#include "statistics.hpp"
#include "variable.hpp"
#include "variable_info.hpp"
#include <cassert>
#include <iomanip>
Include dependency graph for saved_game.cpp:

Go to the source code of this file.


#define ERR_NG   LOG_STREAM(err, log_engine)
#define WRN_NG   LOG_STREAM(warn, log_engine)
#define LOG_NG   LOG_STREAM(info, log_engine)
#define DBG_NG   LOG_STREAM(debug, log_engine)


static void inherit_scenario (config &scenario, config &map_scenario)
void swap (saved_game &lhs, saved_game &rhs)
 Implement non-member swap function for std::swap (calls saved_game::swap). More...


static lg::log_domain log_engine ("engine")
 Some information about savefiles: More...

Macro Definition Documentation


#define DBG_NG   LOG_STREAM(debug, log_engine)

Definition at line 86 of file saved_game.cpp.


#define ERR_NG   LOG_STREAM(err, log_engine)


#define LOG_NG   LOG_STREAM(info, log_engine)


#define WRN_NG   LOG_STREAM(warn, log_engine)

Definition at line 84 of file saved_game.cpp.

Function Documentation

◆ inherit_scenario()

static void inherit_scenario ( config scenario,
config map_scenario 

◆ swap()

void swap ( saved_game lhs,
saved_game rhs 

Implement non-member swap function for std::swap (calls saved_game::swap).

Definition at line 805 of file saved_game.cpp.

References saved_game::swap().

Referenced by saved_game::swap().

Variable Documentation

◆ log_engine

lg::log_domain log_engine("engine")

Some information about savefiles:

A savefile can contain:

  • General information (toplevel attributes, [multiplayer]) This is present in all savefiles
  • [statistics] This is present in all savefiles but it's not handled by playcampaign/play_controller/saved_game. It's handled by savegame.cpp
  • [snapshot] If a savegame was saved during a scenario this contains a snapshot of the game at the point when it was saved.
  • [carryover_sides_start] At start-of-scenario saves this contains data from the previous scenario that was preserved.
  • [carryover_sides] In savefile made during the game, this tag contains data from [carryover_sides_start] that was not used in the current scenario but should be saved for a next scenario
  • [replay_start] A snapshot made very early to replay the game from.
  • [replay] A record of game actions that was made between the creation of [replay_start] and [snapshot].

The following types of savegames are known:

  • Start of scenario savefiles These files only contain general information, statistics, and [carryover_sides_start]. When these saves are loaded, the scenario data is loaded form the game config using the next_scenario attribute from [carryover_sides_start].
  • Expanded Start of scenario savefiles Similar to normal Start-of-scenario savefiles, but the also contain a [scenario] that contains the scenario data. This type is only used internally and usually doesn't get written to the disk.
  • In-game savefile These files contain general information, statistics, [snapshot], [replay], [replay_start], [snapshot], and [carryover_sides]. These files don't contain a [carryover_sides_start] because both starting points ([replay_start] and [snapshot]) were made after [carryover_sides_start] was merged into the scenario.
  • Replay savefiles Like a in-game save made during linger mode, but without the [snapshot].