1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Refactor ModConfiguration

This commit is contained in:
rubenwardy 2022-05-07 16:44:46 +01:00
parent 1d512ef7f4
commit 06de82fd86
10 changed files with 501 additions and 409 deletions

View file

@ -58,6 +58,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "game.h"
#include "chatmessage.h"
#include "translation.h"
#include "content/mod_configuration.h"
extern gui::IGUIEnvironment* guienv;
@ -196,7 +197,21 @@ void Client::loadMods()
scanModIntoMemory(BUILTIN_MOD_NAME, getBuiltinLuaPath());
m_script->loadModFromMemory(BUILTIN_MOD_NAME);
ClientModConfiguration modconf(getClientModsLuaPath());
ModConfiguration modconf;
{
std::unordered_map<std::string, std::string> paths;
std::string path_user = porting::path_user + DIR_DELIM + "clientmods";
const auto modsPath = getClientModsLuaPath();
if (modsPath != path_user) {
paths["share"] = modsPath;
}
paths["mods"] = path_user;
std::string settings_path = path_user + DIR_DELIM + "mods.conf";
modconf.addModsFromConfig(settings_path, paths);
modconf.checkConflictsAndDeps();
}
m_mods = modconf.getMods();
// complain about mods with unsatisfied dependencies
if (!modconf.isConsistent()) {