X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fserverlist.cpp;h=87ca5dc04487c1ba5b74af2dd85b6449d744c66d;hb=3e30731c1ac313b504ff15eb7f40ce6a387d3da2;hp=a3353340eeb232e1eb9d8f241e9386d773f7b94b;hpb=5a0ed780f56a5225b3d7c5f64099586e390e5f39;p=minetest.git diff --git a/src/serverlist.cpp b/src/serverlist.cpp index a3353340e..87ca5dc04 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -17,19 +17,19 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #include #include #include #include "version.h" -#include "main.h" // for g_settings #include "settings.h" #include "serverlist.h" #include "filesys.h" #include "porting.h" #include "log.h" #include "network/networkprotocol.h" -#include "json/json.h" +#include #include "convert_json.h" #include "httpfetch.h" #include "util/string.h" @@ -69,8 +69,12 @@ std::vector getLocal() std::vector getOnline() { std::ostringstream geturl; + + u16 proto_version_min = g_settings->getFlag("send_pre_v25_init") ? + CLIENT_PROTOCOL_VERSION_MIN_LEGACY : CLIENT_PROTOCOL_VERSION_MIN; + geturl << g_settings->get("serverlist_url") << - "/list?proto_version_min=" << CLIENT_PROTOCOL_VERSION_MIN << + "/list?proto_version_min=" << proto_version_min << "&proto_version_max=" << CLIENT_PROTOCOL_VERSION_MAX; Json::Value root = fetchJsonValue(geturl.str(), NULL); @@ -165,7 +169,7 @@ const std::string serialize(const std::vector &serverlist) std::string liststring; for (std::vector::const_iterator it = serverlist.begin(); it != serverlist.end(); - it++) { + ++it) { liststring += "[server]\n"; liststring += (*it)["name"].asString() + '\n'; liststring += (*it)["address"].asString() + '\n'; @@ -182,7 +186,7 @@ const std::string serializeJson(const std::vector &serverlist) Json::Value list(Json::arrayValue); for (std::vector::const_iterator it = serverlist.begin(); it != serverlist.end(); - it++) { + ++it) { list.append(*it); } root["list"] = list; @@ -212,7 +216,7 @@ void sendAnnounce(const std::string &action, bool strict_checking = g_settings->getBool("strict_protocol_version_checking"); server["name"] = g_settings->get("server_name"); server["description"] = g_settings->get("server_description"); - server["version"] = minetest_version_simple; + server["version"] = g_version_string; server["proto_min"] = strict_checking ? LATEST_PROTOCOL_VERSION : SERVER_PROTOCOL_VERSION_MIN; server["proto_max"] = strict_checking ? LATEST_PROTOCOL_VERSION : SERVER_PROTOCOL_VERSION_MAX; server["url"] = g_settings->get("server_url");