This class is responsible for reading all available achievements from mainline's and any add-ons' achievements.cfg files for use in achievements_dialog. More...
#include <achievements.hpp>
Public Member Functions | |
achievements () | |
void | reload () |
Reads the mainline achievements.cfg and then all the achievements of each installed add-on. More... | |
std::vector< achievement_group > & | get_list () |
Private Member Functions | |
config | read_achievements_file (const std::string &path) |
Reads an achievements.cfg file into a config. More... | |
void | process_achievements_file (const config &cfg, const std::string &content_source) |
Processes a config object to add new achievements to achievement_list_. More... | |
Private Attributes | |
std::vector< achievement_group > | achievement_list_ |
This class is responsible for reading all available achievements from mainline's and any add-ons' achievements.cfg files for use in achievements_dialog.
Definition at line 97 of file achievements.hpp.
achievements::achievements | ( | ) |
Definition at line 93 of file achievements.cpp.
References reload().
|
inline |
Definition at line 102 of file achievements.hpp.
References achievement_list_.
Referenced by game_config_manager::get_achievements().
|
private |
Processes a config object to add new achievements to achievement_list_.
cfg | The config containing additional achievements. |
content_source | The source of the additional achievements - either mainline or an add-on. |
Definition at line 154 of file achievements.cpp.
References achievement_list_, config::child_range(), and ERR_CONFIG.
Referenced by reload().
|
private |
Reads an achievements.cfg file into a config.
path | The path to the achievements.cfg file. |
Definition at line 138 of file achievements.cpp.
References filesystem::file_exists(), game_config::path, preprocess_file(), and read().
Referenced by reload().
void achievements::reload | ( | ) |
Reads the mainline achievements.cfg and then all the achievements of each installed add-on.
This is intentionally handled separately from other WML loading so that: a) All achievements and their status are able to be displayed on the main menu right after Wesnoth starts and regardless of which add-ons are active. b) Add-ons can add additional achievements to other content, whether UMC or mainline. For example, a modification that adds more achievements for mainline campaigns.
NOTE: These are not in any way related to Steam achievements!
Definition at line 108 of file achievements.cpp.
References achievement_list_, e, ERR_CONFIG, filesystem::get_addons_dir(), filesystem::get_files_in_dir(), game_config::path, process_achievements_file(), and read_achievements_file().
Referenced by achievements(), and game_config_manager::load_game_config().
|
private |
Definition at line 111 of file achievements.hpp.
Referenced by get_list(), process_achievements_file(), and reload().