The Battle for Wesnoth  1.19.7+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 "utils/optional_fwd.hpp"
25 
26 #include <chrono>
27 
29 {
31  mp_game_settings(const config& cfg);
32 
33  config to_config() const;
34 
35  // The items returned while configuring the game
36 
37  std::string name;
38  std::string password;
39  std::string hash;
40  std::string mp_era_name;
41  std::string mp_scenario;
42  std::string mp_scenario_name;
43  std::string mp_campaign;
44  std::map<std::string, std::string> side_users;
45 
46  int num_turns;
50  std::chrono::seconds mp_countdown_init_time;
51  std::chrono::seconds mp_countdown_reservoir_time;
52  std::chrono::seconds mp_countdown_turn_bonus;
53  std::chrono::seconds mp_countdown_action_bonus;
57  bool fog_game;
62 
64 
66 
68 
70  {
71  std::string id;
72  std::string name;
73  std::string type;
74  };
75 
77  {
78  utils::optional<version_info> version;
79  utils::optional<version_info> min_version;
80  std::string name;
81  bool required;
82  std::vector<addon_content> content;
83 
84  explicit addon_version_info(const config &);
85  void write(config &) const;
86  };
87 
88  /** the key is the addon_id */
89  std::map<std::string, addon_version_info> addons;
90 
91  /**
92  * Takes a config with addon metadata (id, name, version, min_version) and adds
93  * it as a requirement for this game. It also updates min_version if there was
94  * already an entry for this addon_id.
95  */
96  void update_addon_requirements(const config& addon_cfg);
97 };
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:172
Definitions for the interface to Wesnoth Markup Language (WML).
Interfaces for manipulating version numbers of engine, add-ons, etc.
std::vector< addon_content > content
utils::optional< version_info > min_version
utils::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::chrono::seconds mp_countdown_reservoir_time
std::string mp_scenario_name
std::string mp_era_name
std::chrono::seconds mp_countdown_action_bonus
std::chrono::seconds mp_countdown_turn_bonus
std::map< std::string, std::string > side_users
std::chrono::seconds mp_countdown_init_time
std::map< std::string, addon_version_info > addons
the key is the addon_id
saved_game_mode::type saved_game
std::string mp_scenario