The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
game_config_manager.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2013 - 2025
3 by Andrius Silinskas <silinskas.andrius@gmail.com>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16#pragma once
17
18#include "achievements.hpp"
20#include "config.hpp"
21#include "config_cache.hpp"
22#include "filesystem.hpp"
23#include "game_config_view.hpp"
24#include "terrain/type_data.hpp"
26
29{
30 friend class game_config_view;
31public:
32 game_config_manager(const commandline_options& cmdline_opts);
34
37
39 {
40 /** Always reload config */
42 /** Don't reload if the previous defines equal the new defines */
44 /** Don't reload if the previous defines include the new defines */
46 };
47
49 const preproc_map& old_defines_map() const { return old_defines_map_; }
50 std::vector<achievement_group>& get_achievements() { return achievements_.get_list(); }
51
52 bool init_game_config(FORCE_RELOAD_CONFIG force_reload);
54
56 void load_game_config_for_game(const game_classification& classification, const std::string& scenario_id);
57 void load_game_config_for_create(bool is_mp, bool is_test = false);
58
59 static game_config_manager * get();
60
61private:
62 void set_enabled_addon(const std::set<std::string>& addon_ids);
64
65 void load_game_config(bool reload_everything, const game_classification* classification, const std::string& scenario_id);
66
67 void load_game_config_with_loadscreen(FORCE_RELOAD_CONFIG force_reload, const game_classification* classification, const std::string& scenario_id);
68
69 // load_game_config() helper functions.
70 void load_addons_cfg();
72 void set_unit_data();
73
75
78
79 std::map<std::string, config> addon_cfgs_;
80 std::set<std::string> active_addons_;
81
83
85
87
89
91};
This class is responsible for reading all available achievements from mainline's and any add-ons' ach...
std::vector< achievement_group > & get_list()
A config object defines a single node in a WML file, with access to child nodes.
Definition config.hpp:157
Singleton class to manage game config file caching.
void load_game_config_with_loadscreen(FORCE_RELOAD_CONFIG force_reload, const game_classification *classification, const std::string &scenario_id)
@ FORCE_RELOAD
Always reload config.
@ NO_INCLUDE_RELOAD
Don't reload if the previous defines include the new defines.
@ NO_FORCE_RELOAD
Don't reload if the previous defines equal the new defines.
std::map< std::string, config > addon_cfgs_
bool init_game_config(FORCE_RELOAD_CONFIG force_reload)
static game_config_manager * get()
void load_game_config_for_game(const game_classification &classification, const std::string &scenario_id)
void load_game_config(bool reload_everything, const game_classification *classification, const std::string &scenario_id)
std::set< std::string > active_addons_
void load_game_config_for_create(bool is_mp, bool is_test=false)
filesystem::binary_paths_manager paths_manager_
game_config_view game_config_view_
game_config::config_cache & cache_
game_config_manager(const game_config_manager &)=delete
void set_enabled_addon(const std::set< std::string > &addon_ids)
std::vector< achievement_group > & get_achievements()
game_config_manager & operator=(const game_config_manager &)=delete
const game_config_view & game_config() const
const commandline_options & cmdline_opts_
const preproc_map & old_defines_map() const
A class grating read only view to a vector of config objects, viewed as one config with all children ...
Contains the database of all known terrain types, both those defined explicitly by WML [terrain_type]...
Definition type_data.hpp:41
Definitions for the interface to Wesnoth Markup Language (WML).
Declarations for File-IO.
std::map< std::string, struct preproc_define > preproc_map
The paths manager is responsible for recording the various paths that binary files may be located at.