ModConfiguration is a subset of installed mods. More...
#include <mod_configuration.h>
Collaboration diagram for ModConfiguration:Public Member Functions | |
| bool | isConsistent () const |
| const std::vector< ModSpec > & | getUnsatisfiedMods () const |
| const std::vector< ModSpec > & | getMods () const |
| List of mods sorted such that they can be loaded in the given order with all dependencies being fulfilled. | |
| std::string | getUnsatisfiedModsError () const |
| void | addModsInPath (const std::string &path, const std::string &virtual_path) |
| Adds all mods in the given path. | |
| void | addMods (const std::vector< ModSpec > &new_mods) |
Adds all mods in new_mods | |
| void | addGameMods (const SubgameSpec &gamespec) |
| Adds game mods. | |
| void | addModsFromConfig (const std::string &settings_path, const std::unordered_map< std::string, std::string > &modPaths) |
| Adds mods specified by a world.mt config. | |
| void | checkConflictsAndDeps () |
| Call this function once all mods have been added. | |
Private Member Functions | |
| void | resolveDependencies () |
| move mods from m_unsatisfied_mods to m_sorted_mods in an order that satisfies dependencies | |
Private Attributes | |
| std::string | m_first_mod |
| std::string | m_last_mod |
| std::vector< ModSpec > | m_sorted_mods |
| std::vector< ModSpec > | m_unsatisfied_mods |
| std::unordered_set< std::string > | m_name_conflicts |
ModConfiguration is a subset of installed mods.
This class is used to resolve dependencies and return a sorted list of mods.
This class should not be extended from, but instead used as a component in other classes.
| void ModConfiguration::addGameMods | ( | const SubgameSpec & | gamespec | ) |
Adds game mods.
References addModsInPath(), SubgameSpec::first_mod, SubgameSpec::gamemods_path, SubgameSpec::id, SubgameSpec::last_mod, m_first_mod, and m_last_mod.
Referenced by ServerModManager::ServerModManager(), and ModApiMainMenu::l_check_mod_configuration().
Here is the call graph for this function:
Here is the caller graph for this function:| void ModConfiguration::addMods | ( | const std::vector< ModSpec > & | new_mods | ) |
Adds all mods in new_mods
References fs::IsPathAbsolute(), m_name_conflicts, m_unsatisfied_mods, ModSpec::path, and warningstream.
Referenced by addModsFromConfig(), addModsInPath(), and ModApiMainMenu::l_check_mod_configuration().
Here is the call graph for this function:
Here is the caller graph for this function:| void ModConfiguration::addModsFromConfig | ( | const std::string & | settings_path, |
| const std::unordered_map< std::string, std::string > & | modPaths ) |
Adds mods specified by a world.mt config.
| settings_path | Path to world.mt |
| modPaths | Map from virtual name to mod path |
References addMods(), errorstream, flattenMods(), Settings::get(), getModsInPath(), Settings::getNames(), is_yes(), m_unsatisfied_mods, Settings::readConfigFile(), Settings::setBool(), and Settings::updateConfigFile().
Referenced by ServerModManager::ServerModManager(), and Client::loadMods().
Here is the call graph for this function:
Here is the caller graph for this function:| void ModConfiguration::addModsInPath | ( | const std::string & | path, |
| const std::string & | virtual_path ) |
Adds all mods in the given path.
used for games, modpacks and world-specific mods (worldmods-folders)
| path | To search, should be absolute |
| virtual_path | Virtual path for this directory, see comment in ModSpec |
References addMods(), flattenMods(), and getModsInPath().
Referenced by ServerModManager::ServerModManager(), addGameMods(), and ModApiMainMenu::l_check_mod_configuration().
Here is the call graph for this function:
Here is the caller graph for this function:| void ModConfiguration::checkConflictsAndDeps | ( | ) |
Call this function once all mods have been added.
References m_name_conflicts, and resolveDependencies().
Referenced by ServerModManager::ServerModManager(), ModApiMainMenu::l_check_mod_configuration(), and Client::loadMods().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
List of mods sorted such that they can be loaded in the given order with all dependencies being fulfilled.
I.e: every mod in this list has only dependencies on mods which appear earlier in the vector.
References m_sorted_mods.
Referenced by ServerModManager::getModNames(), ServerModManager::getMods(), ServerModManager::getModsMediaPaths(), ServerModManager::getModSpec(), ModApiMainMenu::l_check_mod_configuration(), Client::loadMods(), and ServerModManager::loadMods().
Here is the caller graph for this function:
|
inline |
References m_unsatisfied_mods.
Referenced by ServerModManager::getUnsatisfiedMods(), and ModApiMainMenu::l_check_mod_configuration().
Here is the caller graph for this function:| std::string ModConfiguration::getUnsatisfiedModsError | ( | ) | const |
References fmtgettext(), and m_unsatisfied_mods.
Referenced by ServerModManager::getUnsatisfiedModsError(), and Client::loadMods().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
References m_unsatisfied_mods.
Referenced by ServerModManager::isConsistent(), ModApiMainMenu::l_check_mod_configuration(), and Client::loadMods().
Here is the caller graph for this function:
|
private |
move mods from m_unsatisfied_mods to m_sorted_mods in an order that satisfies dependencies
References g_settings, Settings::getBool(), m_first_mod, m_last_mod, m_sorted_mods, m_unsatisfied_mods, ModSpec::name, and ModSpec::unsatisfied_depends.
Referenced by checkConflictsAndDeps().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Referenced by addGameMods(), and resolveDependencies().
|
private |
Referenced by addGameMods(), and resolveDependencies().
|
private |
Referenced by addMods(), and checkConflictsAndDeps().
|
private |
Referenced by getMods(), and resolveDependencies().
|
private |
Referenced by addMods(), addModsFromConfig(), getUnsatisfiedMods(), getUnsatisfiedModsError(), isConsistent(), and resolveDependencies().