Fix mod store rating
authorShadowNinja <shadowninja@minetest.net>
Fri, 19 Sep 2014 19:41:28 +0000 (15:41 -0400)
committerShadowNinja <shadowninja@minetest.net>
Tue, 21 Apr 2015 02:48:14 +0000 (22:48 -0400)
src/convert_json.cpp

index 68912d482de84a496b9851fdd55593b407f1f3fb..e03508e21fe2d0a77a76013d3f3a79a3168c9a0c 100644 (file)
@@ -356,18 +356,10 @@ ModStoreModDetails          readModStoreModDetails(Json::Value& details) {
        }
 
        //value
-       if (details["rating"].asString().size()) {
-
-               std::string id_raw = details["rating"].asString();
-               char* endptr = 0;
-               float numbervalue = strtof(id_raw.c_str(),&endptr);
-
-               if ((id_raw != "") && (*endptr == 0)) {
-                       retval.rating = numbervalue;
-               }
-       }
-       else {
-               retval.rating = 0.0;
+       if (details["value"].isInt()) {
+               retval.rating = details["value"].asInt();
+       } else {
+               retval.rating = 0;
        }
 
        //depends