The Battle for Wesnoth  1.15.1+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_cache.hpp"
19 #include "filesystem.hpp"
20 #include "terrain/type_data.hpp"
21 
22 class config;
24 
26 {
27 public:
28  game_config_manager(const commandline_options& cmdline_opts, const bool jump_to_editor);
31  {
32  /// Always reload config
34  /// Don't reload if the previous defines equal the new defines
36  /// Don't reload if the previous defines include the new defines
38  };
39 
40  const config& game_config() const { return game_config_; }
41  const preproc_map& old_defines_map() const { return old_defines_map_; }
42  const ter_data_cache & terrain_types() const { return tdata_; }
43 
44  bool init_game_config(FORCE_RELOAD_CONFIG force_reload);
46 
49  void load_game_config_for_create(bool is_mp, bool is_test = false);
50 
51  static game_config_manager * get();
52 
53 private:
55  void operator=(const game_config_manager&);
56 
57  void load_game_config(FORCE_RELOAD_CONFIG force_reload,
58  game_classification const* classification = nullptr);
59 
61  game_classification const* classification = nullptr);
62 
63  // load_game_config() helper functions.
64  void load_addons_cfg();
66  void set_unit_data();
67 
69  const bool jump_to_editor_;
70 
72 
74 
76 
78 
80 };
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
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:360
Don&#39;t reload if the previous defines equal the new defines.
game_config_manager(const commandline_options &cmdline_opts, const bool jump_to_editor)
void load_game_config_for_create(bool is_mp, bool is_test=false)
Declarations for File-IO.
void operator=(const game_config_manager &)
void load_game_config_for_game(const game_classification &classification)
const preproc_map & old_defines_map() const
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:92
bool init_game_config(FORCE_RELOAD_CONFIG force_reload)
const config & game_config() const
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.
std::shared_ptr< terrain_type_data > ter_data_cache