The Battle for Wesnoth  1.17.10+dev
mp_game_settings.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 - 2022
3  by Joerg Hinrichs <joerg.hinrichs@alice-dsl.de>
4  Copyright (C) 2003 by David White <dave@whitevine.net>
5  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY.
13 
14  See the COPYING file for more details.
15 */
16 
17 #pragma once
18 
19 #include "config.hpp"
22 #include "game_version.hpp"
23 #include "gettext.hpp"
24 
25 #include <optional>
26 
28 {
30  mp_game_settings(const config& cfg);
31 
32  config to_config() const;
33 
34  // The items returned while configuring the game
35 
36  std::string name;
37  std::string password;
38  std::string hash;
39  std::string mp_era_name;
40  std::string mp_scenario;
41  std::string mp_scenario_name;
42  std::string mp_campaign;
43  std::map<std::string, std::string> side_users;
44 
45  int num_turns;
56  bool fog_game;
61 
63 
65 
67 
69  {
70  std::string id;
71  std::string name;
72  std::string type;
73  };
74 
76  {
77  std::optional<version_info> version;
78  std::optional<version_info> min_version;
79  std::string name;
80  bool required;
81  std::vector<addon_content> content;
82 
83  explicit addon_version_info(const config &);
84  void write(config &) const;
85  };
86 
87  /** the key is the addon_id */
88  std::map<std::string, addon_version_info> addons;
89 
90  /**
91  * Takes a config with addon metadata (id, name, version, min_version) and adds
92  * it as a requirement for this game. It also updates min_version if there was
93  * already an entry for this addon_id.
94  */
95  void update_addon_requirements(const config& addon_cfg);
96 };
std::string mp_scenario
Interfaces for manipulating version numbers of engine, add-ons, etc.
std::string mp_campaign
std::string mp_era_name
Definitions for the interface to Wesnoth Markup Language (WML).
std::string mp_scenario_name
config to_config() const
void write(std::ostream &out, const configr_of &cfg, unsigned int level)
Definition: parser.cpp:764
void update_addon_requirements(const config &addon_cfg)
Takes a config with addon metadata (id, name, version, min_version) and adds it as a requirement for ...
std::vector< addon_content > content
saved_game_mode::type saved_game
std::optional< version_info > version
std::map< std::string, addon_version_info > addons
the key is the addon_id
random_faction_mode::type mode
std::map< std::string, std::string > side_users
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:60
std::optional< version_info > min_version