diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-01-27 07:41:10 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-03-13 23:56:05 +0100 |
commit | 92b45b2a189b703fc7cfc8ddbc09a7ad563a13bc (patch) | |
tree | 146edaf44e3cbeca55c34e6d30b375dd053877b4 /src/server.cpp | |
parent | c42c53fccf87a3819ca78de52f8f20c47c4fbb9f (diff) | |
download | minetest-92b45b2a189b703fc7cfc8ddbc09a7ad563a13bc.tar.gz minetest-92b45b2a189b703fc7cfc8ddbc09a7ad563a13bc.tar.bz2 minetest-92b45b2a189b703fc7cfc8ddbc09a7ad563a13bc.zip |
[CSM] implement client side mod loading (#5123)
* client side mods are located in clientmods/
* move builtin/preview.lua to clientmods/preview/init.lua as a preview mod
* refactor ModConfiguration class to work properly with client and server using child objects
* move some Server constructor mod load code to ModConfiguration to reduce code duplication between client and server
* remove mods.{cpp,h} unused functions
* use UNORDERED_SET instead of std::set in some modspec storages
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/src/server.cpp b/src/server.cpp index 3adbf40cc..dd6c9a418 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -218,20 +218,12 @@ Server::Server( std::string ban_path = m_path_world + DIR_DELIM "ipban.txt"; m_banmanager = new BanManager(ban_path); - ModConfiguration modconf(m_path_world); + ServerModConfiguration modconf(m_path_world); m_mods = modconf.getMods(); std::vector<ModSpec> unsatisfied_mods = modconf.getUnsatisfiedMods(); // complain about mods with unsatisfied dependencies - if(!modconf.isConsistent()) { - for(std::vector<ModSpec>::iterator it = unsatisfied_mods.begin(); - it != unsatisfied_mods.end(); ++it) { - ModSpec mod = *it; - errorstream << "mod \"" << mod.name << "\" has unsatisfied dependencies: "; - for(std::set<std::string>::iterator dep_it = mod.unsatisfied_depends.begin(); - dep_it != mod.unsatisfied_depends.end(); ++dep_it) - errorstream << " \"" << *dep_it << "\""; - errorstream << std::endl; - } + if (!modconf.isConsistent()) { + modconf.printUnsatisfiedModsError(); } Settings worldmt_settings; @@ -271,20 +263,17 @@ Server::Server( m_script = new ServerScripting(this); - std::string script_path = getBuiltinLuaPath() + DIR_DELIM "init.lua"; - - m_script->loadMod(script_path, BUILTIN_MOD_NAME); + m_script->loadMod(getBuiltinLuaPath() + DIR_DELIM "init.lua", BUILTIN_MOD_NAME); // Print mods infostream << "Server: Loading mods: "; - for(std::vector<ModSpec>::iterator i = m_mods.begin(); + for (std::vector<ModSpec>::const_iterator i = m_mods.begin(); i != m_mods.end(); ++i) { - const ModSpec &mod = *i; - infostream << mod.name << " "; + infostream << (*i).name << " "; } infostream << std::endl; // Load and run "mod" scripts - for (std::vector<ModSpec>::iterator it = m_mods.begin(); + for (std::vector<ModSpec>::const_iterator it = m_mods.begin(); it != m_mods.end(); ++it) { const ModSpec &mod = *it; if (!string_allowed(mod.name, MODNAME_ALLOWED_CHARS)) { |