]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/mods.cpp
Drop luaentity_common.h which is not included anywhere
[dragonfireclient.git] / src / mods.cpp
index 6126de7a19d1b08b9edcd55ecd4255438cf4f021..be6e1e5d30f06a1dba0b77053a346a944fc5e474 100644 (file)
@@ -17,16 +17,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include <cctype>
+#include <fstream>
 #include "mods.h"
-#include "main.h"
 #include "filesys.h"
 #include "strfnd.h"
 #include "log.h"
 #include "subgame.h"
 #include "settings.h"
 #include "strfnd.h"
-#include <cctype>
 #include "convert_json.h"
+#include "exceptions.h"
 
 static bool parseDependsLine(std::istream &is,
                std::string &dep, std::set<char> &symbols)
@@ -47,6 +48,11 @@ static bool parseDependsLine(std::istream &is,
 void parseModContents(ModSpec &spec)
 {
        // NOTE: this function works in mutual recursion with getModsInPath
+       Settings info;
+       info.readConfigFile((spec.path+DIR_DELIM+"mod.conf").c_str());
+
+       if (info.exists("name"))
+               spec.name = info.get("name");
 
        spec.depends.clear();
        spec.optdepends.clear();
@@ -251,7 +257,7 @@ void ModConfiguration::addMods(std::vector<ModSpec> new_mods)
                                // BAD CASE: name conflict in different levels.
                                u32 oldindex = existing_mods[mod.name];
                                const ModSpec &oldmod = m_unsatisfied_mods[oldindex];
-                               actionstream<<"WARNING: Mod name conflict detected: \""
+                               warningstream<<"Mod name conflict detected: \""
                                        <<mod.name<<"\""<<std::endl
                                        <<"Will not load: "<<oldmod.path<<std::endl
                                        <<"Overridden by: "<<mod.path<<std::endl;
@@ -265,7 +271,7 @@ void ModConfiguration::addMods(std::vector<ModSpec> new_mods)
                                // VERY BAD CASE: name conflict in the same level.
                                u32 oldindex = existing_mods[mod.name];
                                const ModSpec &oldmod = m_unsatisfied_mods[oldindex];
-                               errorstream<<"WARNING: Mod name conflict detected: \""
+                               warningstream<<"Mod name conflict detected: \""
                                        <<mod.name<<"\""<<std::endl
                                        <<"Will not load: "<<oldmod.path<<std::endl
                                        <<"Will not load: "<<mod.path<<std::endl;