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)
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();
for(std::vector<ModSpec>::const_iterator it = new_mods.begin();
it != new_mods.end(); ++it){
const ModSpec &mod = *it;
- if(mod.part_of_modpack != want_from_modpack)
+ if(mod.part_of_modpack != (bool)want_from_modpack)
continue;
if(existing_mods.count(mod.name) == 0){
// GOOD CASE: completely new mod.
// 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;
// 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;
bool special_http_header = true;
- try{
+ try {
special_http_header = g_settings->getBool("modstore_disable_special_http_header");
- }
- catch(SettingNotFoundException &e) {
- }
+ } catch (SettingNotFoundException) {}
if (special_http_header) {
extra_headers.push_back("Accept: application/vnd.minetest.mmdb-v1+json");
- return fetchJsonValue(url, &extra_headers);
- }
- else {
- return fetchJsonValue(url, NULL);
}
+ return fetchJsonValue(url, special_http_header ? &extra_headers : NULL);
}
#endif