The Battle for Wesnoth  1.15.1+dev
game_end_exceptions.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 - 2018 by Joerg Hinrichs <joerg.hinrichs@alice-dsl.de>
3  wesnoth playturn Copyright (C) 2003 by David White <dave@whitevine.net>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #include "game_end_exceptions.hpp"
17 
18 #include "config.hpp"
19 
21  : carryover_report(true)
22  , linger_mode(true)
23  , reveal_map(true)
24 {}
25 
27  : prescenario_save(true)
28  , replay_save(true)
29  , proceed_to_next_level(false)
30  , is_victory(true)
31  , transient()
32 {
33 }
34 
35 void end_level_data::write(config& cfg) const
36 {
37  cfg["prescenario_save"] = prescenario_save;
38  cfg["replay_save"] = replay_save;
39  cfg["proceed_to_next_level"] = proceed_to_next_level;
40  cfg["is_victory"] = is_victory;
41 }
42 
43 void end_level_data::read(const config& cfg)
44 {
45  prescenario_save = cfg["prescenario_save"].to_bool(true);
46  replay_save = cfg["replay_save"].to_bool(true);
47  proceed_to_next_level = cfg["proceed_to_next_level"].to_bool(true);
48  is_victory = cfg["is_victory"].to_bool(true);
49 }
50 
52 {
53  config r;
54  write(r);
55  return r;
56 }
57 
59 {
60  config r;
61  write(r);
62  transient.write(r);
63  return r;
64 }
65 
67 {
68  cfg["carryover_report"] = carryover_report;
69  cfg["linger_mode"] = linger_mode;
70  cfg["reveal_map"] = reveal_map;
71 }
void read(const config &cfg)
bool prescenario_save
Should a prescenario be created the next game?
bool replay_save
Should a replay save be made?
void write(config &cfg) const
Contains the exception interfaces used to signal completion of a scenario, campaign or turn...
Definitions for the interface to Wesnoth Markup Language (WML).
void write(config &cfg) const
config to_config() const
bool proceed_to_next_level
whether to proceed to the next scenario, equals is_victory in sp.
config to_config_full() const
Includes the transient data.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:68