The Battle for Wesnoth  1.15.5+dev
mp_game_settings.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2018 by Jörg Hinrichs
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 /** @file */
16 
17 #pragma once
18 
19 #include "config.hpp"
20 #include "gettext.hpp"
21 #include "utils/make_enum.hpp"
22 #include "game_version.hpp"
23 
24 #include <boost/optional.hpp>
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 
42  std::map<std::string, std::string> side_users;
43 
44  int num_turns;
55  bool fog_game;
61 
62  MAKE_ENUM(SAVED_GAME_MODE,
63  (NONE, "no")
64  (MIDGAME, "midgame")
65  (SCENARIO_START, "scenaro_start")
66  )
67 
68  SAVED_GAME_MODE saved_game;
69 
70  // HACK: The Create Game dialog has special knowledge of these strings
71  // and the fact that they're placed in the default (wesnoth)
72  // textdomain by xgettext due to the absence of a GETTEXT_DOMAIN
73  // declaration in this file. See gui2::dialogs::mp_create_game::pre_show().
74  MAKE_ENUM(RANDOM_FACTION_MODE,
75  (DEFAULT, N_("Independent"))
76  (NO_MIRROR, N_("No Mirror"))
77  (NO_ALLY_MIRROR, N_("No Ally Mirror"))
78  )
79 
80  RANDOM_FACTION_MODE random_faction_mode;
81 
83 
85  {
88  };
89 
91  {
92  boost::optional<version_info> version;
93  boost::optional<version_info> min_version;
95  bool required;
96  std::vector<addon_content> content;
97 
98  explicit addon_version_info(const config &);
99  void write(config &) const;
100  };
101 
102  std::map<std::string, addon_version_info> addons; // the key is the addon_id
103 
104  /**
105  * Takes a config with addon metadata (id, name, version, min_version) and adds
106  * it as a requirement for this game. It also updates min_version if there was
107  * already an entry for this addon_id.
108  */
109  void update_addon_requirements(const config& addon_cfg);
110 };
boost::optional< version_info > version
std::string mp_scenario
std::string random_faction_mode()
Definition: game.cpp:507
Interfaces for manipulating version numbers of engine, add-ons, etc.
std::string mp_campaign
boost::optional< version_info > min_version
std::string mp_era_name
Definitions for the interface to Wesnoth Markup Language (WML).
std::string mp_scenario_name
config to_config() const
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
MAKE_ENUM(SAVED_GAME_MODE,(NONE, "no")(MIDGAME, "midgame")(SCENARIO_START, "scenaro_start")) SAVED_GAME_MODE saved_game
Default, unset return value.
Definition: retval.hpp:31
std::map< std::string, addon_version_info > addons
#define N_(String)
Definition: gettext.hpp:108
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:68
Defines the MAKE_ENUM macro.