The Battle for Wesnoth  1.15.7+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;
60 
61  MAKE_ENUM(SAVED_GAME_MODE,
62  (NONE, "no")
63  (MIDGAME, "midgame")
64  (SCENARIO_START, "scenaro_start")
65  )
66 
67  SAVED_GAME_MODE saved_game;
68 
69  // HACK: The Create Game dialog has special knowledge of these strings
70  // and the fact that they're placed in the default (wesnoth)
71  // textdomain by xgettext due to the absence of a GETTEXT_DOMAIN
72  // declaration in this file. See gui2::dialogs::mp_create_game::pre_show().
73  MAKE_ENUM(RANDOM_FACTION_MODE,
74  (DEFAULT, N_("Independent"))
75  (NO_MIRROR, N_("No Mirror"))
76  (NO_ALLY_MIRROR, N_("No Ally Mirror"))
77  )
78 
79  RANDOM_FACTION_MODE random_faction_mode;
80 
82 
84  {
87  };
88 
90  {
91  boost::optional<version_info> version;
92  boost::optional<version_info> min_version;
94  bool required;
95  std::vector<addon_content> content;
96 
97  explicit addon_version_info(const config &);
98  void write(config &) const;
99  };
100 
101  std::map<std::string, addon_version_info> addons; // the key is the addon_id
102 
103  /**
104  * Takes a config with addon metadata (id, name, version, min_version) and adds
105  * it as a requirement for this game. It also updates min_version if there was
106  * already an entry for this addon_id.
107  */
108  void update_addon_requirements(const config& addon_cfg);
109 };
boost::optional< version_info > version
std::string mp_scenario
std::string random_faction_mode()
Definition: game.cpp:497
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.