The Battle for Wesnoth  1.19.1+dev
mp_game_settings.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 - 2024
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 
24 #include <optional>
25 
27 {
29  mp_game_settings(const config& cfg);
30 
31  config to_config() const;
32 
33  // The items returned while configuring the game
34 
35  std::string name;
36  std::string password;
37  std::string hash;
38  std::string mp_era_name;
39  std::string mp_scenario;
40  std::string mp_scenario_name;
41  std::string mp_campaign;
42  std::map<std::string, std::string> side_users;
43 
44  int num_turns;
55  bool fog_game;
60 
62 
64 
66 
68  {
69  std::string id;
70  std::string name;
71  std::string type;
72  };
73 
75  {
76  std::optional<version_info> version;
77  std::optional<version_info> min_version;
78  std::string name;
79  bool required;
80  std::vector<addon_content> content;
81 
82  explicit addon_version_info(const config &);
83  void write(config &) const;
84  };
85 
86  /** the key is the addon_id */
87  std::map<std::string, addon_version_info> addons;
88 
89  /**
90  * Takes a config with addon metadata (id, name, version, min_version) and adds
91  * it as a requirement for this game. It also updates min_version if there was
92  * already an entry for this addon_id.
93  */
94  void update_addon_requirements(const config& addon_cfg);
95 };
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:159
Interfaces for manipulating version numbers of engine, add-ons, etc.
std::optional< version_info > min_version
std::vector< addon_content > content
std::optional< version_info > version
random_faction_mode::type mode
std::string mp_campaign
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 ...
config to_config() const
std::string mp_scenario_name
std::string mp_era_name
std::map< std::string, std::string > side_users
std::map< std::string, addon_version_info > addons
the key is the addon_id
saved_game_mode::type saved_game
std::string mp_scenario