aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Expand)AuthorAge
* Wield: always obey anisotropic_filter setting, not just for hi res texturesKahrl2014-11-26
* EMF_USE_MIP_MAPS was introduced in Irrlicht 1.8, don't use in 1.7.3 or belowKahrl2014-11-26
* added enable_build_where_you_stand optionSokomine2014-11-27
* Wieldmesh: don't force anisotropic filtering on, instead disable mipmapsKahrl2014-11-26
* Only set the camera update keymap when using a debug buildrubenwardy2014-11-26
* Fix Android main menu crash, and user data directory check.Kodexky2014-11-26
* Increase step smoothing to fit 1:1 stairs (works well on slabs too)Calinou2014-11-26
* Fix client "double saving" simple singleplayer local mapsCraig Robbins2014-11-26
* Fixes for Android build errors. Enable sensor landscape rotation.KodexKy2014-11-25
* Port createForsythOptimizedMesh from Irrlicht 1.8RealBadAngel2014-11-23
* Fix regression with USE_REDIS (refactor_main)Craig Robbins2014-11-23
* refactor main.cppCraig Robbins2014-11-23
* Fix smooth lighting (ambient occlusion)Craig Robbins2014-11-22
* Fix compiling if no endian.h foundPavel Puchkin2014-11-22
* serialize.h: use machine native byte swapping if available, fall-back to prev...Rafael Reilova2014-11-21
* Optimise functions from CNodeDefManager and VoxelManipulatorCraig Robbins2014-11-21
* Optimise getTileInfo()Craig Robbins2014-11-21
* Mgv5 1 up 1 down overgeneration for biome surface continuityparamat2014-11-20
* Mgv5 get ground level at point function. Fast spawn player versionparamat2014-11-20
* Simplify loading of Android version of menuShadowNinja2014-11-20
* Fix raillike bug (currently manifests itself on Android), and minor improveme...Kodexky2014-11-20
* Clean up rollbackShadowNinja2014-11-19
* Fix wallmounted mesh rotationsShadowNinja2014-11-19
* Add (optional) client-side saving of server map to disksfan52014-11-19
* Remove unused rangelim function (the macro still exists)Kahrl2014-11-19
* Fix double free bug when server is shut downCraig Robbins2014-11-15
* Fix NoisePerlin3DEased return valuekwolekr2014-11-14
* Fix warnings and other misc. minor changeskwolekr2014-11-14
* Remove most exceptions from getNode() (and variants)Craig Robbins2014-11-14
* Add option 'eased' to NoiseParamsSmallJoker2014-11-13
* Fix compilation under some Linux distributionskwolekr2014-11-13
* Mapgen v7: Fix uninitialized spflagskwolekr2014-11-12
* Add eased 3d point-value noise functionskwolekr2014-11-12
* Add Generator Element Management frameworkkwolekr2014-11-12
* Wielded fixes. Add shaders support.RealBadAngel2014-11-13
* Fix profiler values not being updated (F6) and not being loggedCraig Robbins2014-11-11
* Serverlist: announce mg_name from map_meta.txt instead of minetest.confKahrl2014-11-10
* Merge pull request #1825 from Zeno-/control_key_cacheZeno-2014-11-10
|\
| * Create faster key cache for main game loop (client)Craig Robbins2014-11-10
* | Tune cave noise scales to 6. Fix blobs spflag, now enabled. Update conf.exampleparamat2014-11-09
|/
* Implement WieldMeshSceneNode which improves wield mesh renderingKahrl2014-11-08
* Stop inserting empty lines at end of minetest.conf file each time it is rewri...Craig Robbins2014-11-08
* Fix regressions and minor improvements in refactor_the_gameCraig Robbins2014-11-08
* Add mgv5. New noise code, uses biome API. Eased 3d noise for terrain, caves, ...paramat2014-11-08
* Speed up removing a node (less block mesh updates).RealBadAngel2014-11-08
* Replace setting unlimited_player_transfer_distance with player_transfer_distanceSmallJoker2014-11-08
* Address issues related to refactoring the_gameCraig Robbins2014-11-03
* Fix regression: mouse wheel couldn't scroll from last hotbar item to firstKahrl2014-11-02
* Cleanup and (mostly) document util/string.h and (very) minor refactoringCraig Robbins2014-11-02
* Include mg_decoration.h, mg_ore.h from emerge.cpp to fix warningsKahrl2014-11-02
lass="hl ppc">#include "settings.h" #include "httpfetch.h" #include "porting.h" Json::Value fetchJsonValue(const std::string &url, std::vector<std::string> *extra_headers) { HTTPFetchRequest fetch_request; HTTPFetchResult fetch_result; fetch_request.url = url; fetch_request.caller = HTTPFETCH_SYNC; if (extra_headers != NULL) fetch_request.extra_headers = *extra_headers; httpfetch_sync(fetch_request, fetch_result); if (!fetch_result.succeeded) { return Json::Value(); } Json::Value root; Json::Reader reader; std::istringstream stream(fetch_result.data); if (!reader.parse(stream, root)) { errorstream << "URL: " << url << std::endl; errorstream << "Failed to parse json data " << reader.getFormattedErrorMessages(); errorstream << "data: \"" << fetch_result.data << "\"" << std::endl; return Json::Value(); } return root; } std::vector<ModStoreMod> readModStoreList(Json::Value& modlist) { std::vector<ModStoreMod> retval; if (modlist.isArray()) { for (unsigned int i = 0; i < modlist.size(); i++) { ModStoreMod toadd; toadd.valid = true; //id if (modlist[i]["id"].asString().size()) { std::string id_raw = modlist[i]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { toadd.id = numbervalue; } else { errorstream << "readModStoreList: missing id" << std::endl; toadd.valid = false; } } else { errorstream << "readModStoreList: missing id" << std::endl; toadd.valid = false; } //title if (modlist[i]["title"].asString().size()) { toadd.title = modlist[i]["title"].asString(); } else { errorstream << "readModStoreList: missing title" << std::endl; toadd.valid = false; } //basename if (modlist[i]["basename"].asString().size()) { toadd.basename = modlist[i]["basename"].asString(); } else { errorstream << "readModStoreList: missing basename" << std::endl; toadd.valid = false; } //author //rating //version if (toadd.valid) { retval.push_back(toadd); } } } return retval; } ModStoreModDetails readModStoreModDetails(Json::Value& details) { ModStoreModDetails retval; retval.valid = true; //version set if (details["version_set"].isArray()) { for (unsigned int i = 0; i < details["version_set"].size(); i++) { ModStoreVersionEntry toadd; if (details["version_set"][i]["id"].asString().size()) { std::string id_raw = details["version_set"][i]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { toadd.id = numbervalue; } } else { errorstream << "readModStoreModDetails: missing version_set id" << std::endl; retval.valid = false; } //date if (details["version_set"][i]["date"].asString().size()) { toadd.date = details["version_set"][i]["date"].asString(); } //file if (details["version_set"][i]["file"].asString().size()) { toadd.file = details["version_set"][i]["file"].asString(); } else { errorstream << "readModStoreModDetails: missing version_set file" << std::endl; retval.valid = false; } //approved //mtversion if( retval.valid ) { retval.versions.push_back(toadd); } else { break; } } } if (retval.versions.size() < 1) { infostream << "readModStoreModDetails: not a single version specified!" << std::endl; retval.valid = false; } //categories if (details["categories"].isObject()) { for (unsigned int i = 0; i < details["categories"].size(); i++) { ModStoreCategoryInfo toadd; if (details["categories"][i]["id"].asString().size()) { std::string id_raw = details["categories"][i]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { toadd.id = numbervalue; } } else { errorstream << "readModStoreModDetails: missing categories id" << std::endl; retval.valid = false; } if (details["categories"][i]["title"].asString().size()) { toadd.name = details["categories"][i]["title"].asString(); } else { errorstream << "readModStoreModDetails: missing categories title" << std::endl; retval.valid = false; } if( retval.valid ) { retval.categories.push_back(toadd); } else { break; } } } //author if (details["author"].isObject()) { if (details["author"]["id"].asString().size()) { std::string id_raw = details["author"]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.author.id = numbervalue; } else { errorstream << "readModStoreModDetails: missing author id (convert)" << std::endl; retval.valid = false; } } else { errorstream << "readModStoreModDetails: missing author id" << std::endl; retval.valid = false; } if (details["author"]["username"].asString().size()) { retval.author.username = details["author"]["username"].asString(); } else { errorstream << "readModStoreModDetails: missing author username" << std::endl; retval.valid = false; } } else { errorstream << "readModStoreModDetails: missing author" << std::endl; retval.valid = false; } //license if (details["license"].isObject()) { if (details["license"]["id"].asString().size()) { std::string id_raw = details["license"]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.license.id = numbervalue; } } else { errorstream << "readModStoreModDetails: missing license id" << std::endl; retval.valid = false; } if (details["license"]["short"].asString().size()) { retval.license.shortinfo = details["license"]["short"].asString(); } else { errorstream << "readModStoreModDetails: missing license short" << std::endl; retval.valid = false; } if (details["license"]["link"].asString().size()) { retval.license.url = details["license"]["link"].asString(); } } //titlepic if (details["titlepic"].isObject()) { if (details["titlepic"]["id"].asString().size()) { std::string id_raw = details["titlepic"]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.titlepic.id = numbervalue; } } if (details["titlepic"]["file"].asString().size()) { retval.titlepic.file = details["titlepic"]["file"].asString(); } if (details["titlepic"]["desc"].asString().size()) { retval.titlepic.description = details["titlepic"]["desc"].asString(); } if (details["titlepic"]["mod"].asString().size()) { std::string mod_raw = details["titlepic"]["mod"].asString(); char* endptr = 0; int numbervalue = strtol(mod_raw.c_str(),&endptr,10); if ((mod_raw != "") && (*endptr == 0)) { retval.titlepic.mod = numbervalue; } } } //id if (details["id"].asString().size()) { std::string id_raw = details["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.id = numbervalue; } } else { errorstream << "readModStoreModDetails: missing id" << std::endl; retval.valid = false; } //title if (details["title"].asString().size()) { retval.title = details["title"].asString(); } else { errorstream << "readModStoreModDetails: missing title" << std::endl; retval.valid = false; } //basename if (details["basename"].asString().size()) { retval.basename = details["basename"].asString(); } else { errorstream << "readModStoreModDetails: missing basename" << std::endl; retval.valid = false; } //description if (details["desc"].asString().size()) { retval.description = details["desc"].asString(); } //repository if (details["replink"].asString().size()) { retval.repository = details["replink"].asString(); } //value if (details["value"].isInt()) { retval.rating = details["value"].asInt(); } else { retval.rating = 0; } //depends if (details["depends"].isArray()) { //TODO } //softdepends if (details["softdep"].isArray()) { //TODO } //screenshot url if (details["screenshot_url"].asString().size()) { retval.screenshot_url = details["screenshot_url"].asString(); } return retval; }