The Battle for Wesnoth  1.15.7+dev
game_config_manager.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 2018 by Andrius Silinskas <silinskas.andrius@gmail.com>
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 #pragma once
16 
17 #include "commandline_options.hpp"
18 #include "config.hpp"
19 #include "config_cache.hpp"
20 #include "filesystem.hpp"
21 #include "game_config_view.hpp"
22 #include "terrain/type_data.hpp"
23 #include "utils/optional_fwd.hpp"
24 
27 {
28  friend class game_config_view;
29 public:
30  game_config_manager(const commandline_options& cmdline_opts, const bool jump_to_editor);
33  {
34  /// Always reload config
36  /// Don't reload if the previous defines equal the new defines
38  /// Don't reload if the previous defines include the new defines
40  };
41 
42  const game_config_view& game_config() const { return game_config_view_; }
43  const preproc_map& old_defines_map() const { return old_defines_map_; }
44  const ter_data_cache & terrain_types() const { return tdata_; }
45 
46  bool init_game_config(FORCE_RELOAD_CONFIG force_reload);
48 
51  void load_game_config_for_create(bool is_mp, bool is_test = false);
52 
53  static game_config_manager * get();
54 
55 
56 private:
57  void set_enabled_addon(std::set<std::string> addon_ids);
58  void set_enabled_addon_all();
60  void operator=(const game_config_manager&);
61 
62  void load_game_config(bool reload_everything);
63 
65  game_classification const* classification = nullptr, utils::optional<std::set<std::string>> active_addons = utils::nullopt);
66 
67  // load_game_config() helper functions.
68  void load_addons_cfg();
70  void set_unit_data();
71 
73  const bool jump_to_editor_;
74 
77 
78  std::map<std::string, config> addon_cfgs_;
79  utils::optional<std::set<std::string>> active_addons_;
80 
82 
84 
86 
88 };
Don&#39;t reload if the previous defines include the new defines.
game_classification * classification
Definition: resources.cpp:34
const ter_data_cache & terrain_types() const
void load_game_config_with_loadscreen(FORCE_RELOAD_CONFIG force_reload, game_classification const *classification=nullptr, utils::optional< std::set< std::string >> active_addons=utils::nullopt)
filesystem::binary_paths_manager paths_manager_
The paths manager is responsible for recording the various paths that binary files may be located at...
Definition: filesystem.hpp:386
void load_game_config_for_game(const game_classification &classification, const std::string &scenario_id)
Don&#39;t reload if the previous defines equal the new defines.
Definitions for the interface to Wesnoth Markup Language (WML).
const game_config_view & game_config() const
game_config_view game_config_view_
game_config_manager(const commandline_options &cmdline_opts, const bool jump_to_editor)
void set_enabled_addon(std::set< std::string > addon_ids)
void load_game_config_for_create(bool is_mp, bool is_test=false)
static const boost::none_t nullopt
Declarations for File-IO.
void operator=(const game_config_manager &)
utils::optional< std::set< std::string > > active_addons_
const preproc_map & old_defines_map() const
void load_game_config(bool reload_everything)
const commandline_options & cmdline_opts_
game_config::config_cache & cache_
std::map< std::string, struct preproc_define > preproc_map
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:68
bool init_game_config(FORCE_RELOAD_CONFIG force_reload)
std::map< std::string, config > addon_cfgs_
Singleton class to manage game config file caching.
std::shared_ptr< terrain_type_data > ter_data_cache