26 #define ERR_CONFIG LOG_STREAM(err, log_config) 51 ERR_CONFIG <<
"Error processing mainline achievements, ignoring: " << e.
what();
55 std::vector<std::string> dirs;
57 for(
const std::string& dir : dirs) {
62 ERR_CONFIG <<
"Error processing add-on " << dir <<
" achievements, ignoring: " << e.
what();
92 if(achgrp[
"content_for"].str().empty()) {
93 ERR_CONFIG << content_source +
" achievement_group missing content_for attribute:\n" << achgrp.debug();
101 : display_name_(cfg[
"display_name"].t_str())
102 , content_for_(cfg[
"content_for"].str())
106 std::string
id = ach[
"id"].str();
110 }
else if(
id.find(
',') != std::string::npos) {
void reload()
Reads the mainline achievements.cfg and then all the achievements of each installed add-on...
std::vector< achievement > achievements_
The achievements associated to this content.
static bool file_exists(const bfs::path &fpath)
child_itors child_range(config_key_type key)
std::string content_for_
The internal ID used for this content.
void read(config &cfg, std::istream &in, abstract_validator *validator)
static lg::log_domain log_config("config")
void get_files_in_dir(const std::string &dir, std::vector< std::string > *files, std::vector< std::string > *dirs, name_mode mode, filter_mode filter, reorder_mode reorder, file_tree_checksum *checksum)
Get a list of all files and/or directories in a given directory.
void process_achievements_file(const config &cfg, const std::string &content_source)
Processes a config object to add new achievements to achievement_list_.
std::unique_ptr< std::istream > scoped_istream
bool achievement(const std::string &content_for, const std::string &id)
const char * what() const noexcept
config read_achievements_file(const std::string &path)
Reads an achievements.cfg file into a config.
Declarations for File-IO.
std::vector< achievement_group > achievement_list_
int progress_achievement(const std::string &content_for, const std::string &id, int limit, int max_progress, int amount)
Increments the achievement's current progress by amount if it hasn't already been completed...
achievement_group(const config &cfg)
Base class for all the errors encountered by the engine.
std::string get_addons_dir()
Standard logging facilities (interface).
A config object defines a single node in a WML file, with access to child nodes.
filesystem::scoped_istream preprocess_file(const std::string &fname, preproc_map *defines)
Function to use the WML preprocessor on a file.