The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
game_config_manager.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 2016 by Andrius Silinskas <[email protected]>
3  Part of the Battle for Wesnoth Project http://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 #ifndef GAME_CONFIG_MANAGER_HPP_INCLUDED
15 #define GAME_CONFIG_MANAGER_HPP_INCLUDED
16 
17 #include "commandline_options.hpp"
18 #include "config_cache.hpp"
19 #include "filesystem.hpp"
20 #include "terrain/type_data.hpp"
21 
22 class CVideo;
23 class config;
25 
27 {
28 public:
29  game_config_manager(const commandline_options& cmdline_opts,
30  CVideo& video, const bool jump_to_editor);
33  {
34  /// Always reload config
36  /// Dont reload if the previous defines equal the new defines
38  /// Dont reload if the previous defines include the new defines
40  };
41 
42  const config& game_config() const { return game_config_; }
43  const preproc_map& old_defines_map() const { return old_defines_map_; }
44  const tdata_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);
52 
53  static game_config_manager * get();
54 
55 private:
57  void operator=(const game_config_manager&);
58 
59  void load_game_config(FORCE_RELOAD_CONFIG force_reload,
60  game_classification const* classification = nullptr);
61 
63  game_classification const* classification = nullptr);
64 
65  // load_game_config() helper functions.
66  void load_addons_cfg();
68  void set_color_info();
69  void set_unit_data();
70 
73  const bool jump_to_editor_;
74 
76 
78 
80 
82 
84 };
85 
86 #endif
Dont reload if the previous defines include the new defines.
game_classification * classification
Definition: resources.cpp:37
const preproc_map & old_defines_map() const
Definition: video.hpp:58
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:210
game_config_manager(const commandline_options &cmdline_opts, CVideo &video, const bool jump_to_editor)
Dont reload if the previous defines equal the new defines.
std::map< std::string, preproc_define > preproc_map
void load_game_config_for_create(bool is_mp)
const config & game_config() const
Declarations for File-IO.
void operator=(const game_config_manager &)
const tdata_cache & terrain_types() const
void load_game_config_for_game(const game_classification &classification)
const commandline_options & cmdline_opts_
game_config::config_cache & cache_
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
bool init_game_config(FORCE_RELOAD_CONFIG force_reload)
void load_game_config(FORCE_RELOAD_CONFIG force_reload, game_classification const *classification=nullptr)
void load_game_config_with_loadscreen(FORCE_RELOAD_CONFIG force_reload, game_classification const *classification=nullptr)
Singleton class to manage game config file caching.