@@ -113,11 +113,11 @@ std::map<std::string, ModSpec> flattenModTree(std::map<std::string, ModSpec> mod
113113 ModSpec mod = (*it).second ;
114114 if (mod.is_modpack )
115115 {
116- std::map<std::string, ModSpec> content =
116+ std::map<std::string, ModSpec> content =
117117 flattenModTree (mod.modpack_content );
118118 result.insert (content.begin (),content.end ());
119119 result.insert (std::make_pair (mod.name ,mod));
120- }
120+ }
121121 else // not a modpack
122122 {
123123 result.insert (std::make_pair (mod.name ,mod));
@@ -138,8 +138,8 @@ std::vector<ModSpec> flattenMods(std::map<std::string, ModSpec> mods)
138138 std::vector<ModSpec> content = flattenMods (mod.modpack_content );
139139 result.reserve (result.size () + content.size ());
140140 result.insert (result.end (),content.begin (),content.end ());
141-
142- }
141+
142+ }
143143 else // not a modpack
144144 {
145145 result.push_back (mod);
@@ -163,10 +163,10 @@ ModConfiguration::ModConfiguration(std::string worldpath)
163163 worldmt_settings.readConfigFile (worldmt.c_str ());
164164 std::vector<std::string> names = worldmt_settings.getNames ();
165165 std::set<std::string> include_mod_names;
166- for (std::vector<std::string>::iterator it = names.begin ();
166+ for (std::vector<std::string>::iterator it = names.begin ();
167167 it != names.end (); ++it)
168- {
169- std::string name = *it;
168+ {
169+ std::string name = *it;
170170 // for backwards compatibility: exclude only mods which are
171171 // explicitely excluded. if mod is not mentioned at all, it is
172172 // enabled. So by default, all installed mods are enabled.
@@ -234,7 +234,7 @@ void ModConfiguration::addMods(std::vector<ModSpec> new_mods)
234234 // Add all the mods that come from modpacks
235235 // Second iteration:
236236 // Add all the mods that didn't come from modpacks
237-
237+
238238 std::set<std::string> seen_this_iteration;
239239
240240 for (std::vector<ModSpec>::const_iterator it = new_mods.begin ();
@@ -325,7 +325,7 @@ void ModConfiguration::resolveDependencies()
325325 else {
326326 ++it;
327327 }
328- }
328+ }
329329 }
330330
331331 // Step 4: write back list of unsatisfied mods
@@ -335,7 +335,7 @@ void ModConfiguration::resolveDependencies()
335335#if USE_CURL
336336Json::Value getModstoreUrl (std::string url)
337337{
338- struct curl_slist *chunk = NULL ;
338+ std::vector<std::string> extra_headers ;
339339
340340 bool special_http_header = true ;
341341
@@ -345,15 +345,13 @@ Json::Value getModstoreUrl(std::string url)
345345 catch (SettingNotFoundException &e) {
346346 }
347347
348- if (special_http_header)
349- chunk = curl_slist_append (chunk, " Accept: application/vnd.minetest.mmdb-v1+json" );
350-
351- Json::Value retval = fetchJsonValue (url,chunk);
352-
353- if (chunk != NULL )
354- curl_slist_free_all (chunk);
355-
356- return retval;
348+ if (special_http_header) {
349+ extra_headers.push_back (" Accept: application/vnd.minetest.mmdb-v1+json" );
350+ return fetchJsonValue (url, &extra_headers);
351+ }
352+ else {
353+ return fetchJsonValue (url, NULL );
354+ }
357355}
358356
359357#endif
0 commit comments