mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Server: announce MIN/MAX protocol version supported to serverlist. Client: check serverlist
Client now informs about incompatible servers from the list, this permits to prevent the protocol movements. Server announces its supported protocol versions to master server
This commit is contained in:
@@ -472,6 +472,7 @@ int ModApiMainMenu::l_get_favorites(lua_State *L)
|
||||
|
||||
for (unsigned int i = 0; i < servers.size(); i++)
|
||||
{
|
||||
|
||||
lua_pushnumber(L,index);
|
||||
|
||||
lua_newtable(L);
|
||||
@@ -509,6 +510,18 @@ int ModApiMainMenu::l_get_favorites(lua_State *L)
|
||||
lua_settable(L, top_lvl2);
|
||||
}
|
||||
|
||||
if (servers[i]["proto_min"].asString().size()) {
|
||||
lua_pushstring(L,"proto_min");
|
||||
lua_pushinteger(L,servers[i]["proto_min"].asInt());
|
||||
lua_settable(L, top_lvl2);
|
||||
}
|
||||
|
||||
if (servers[i]["proto_max"].asString().size()) {
|
||||
lua_pushstring(L,"proto_max");
|
||||
lua_pushinteger(L,servers[i]["proto_max"].asInt());
|
||||
lua_settable(L, top_lvl2);
|
||||
}
|
||||
|
||||
if (servers[i]["password"].asString().size()) {
|
||||
lua_pushstring(L,"password");
|
||||
lua_pushboolean(L,servers[i]["password"].asBool());
|
||||
@@ -1082,6 +1095,19 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_get_min_supp_proto(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, CLIENT_PROTOCOL_VERSION_MIN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ModApiMainMenu::l_get_max_supp_proto(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, CLIENT_PROTOCOL_VERSION_MAX);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_do_async_callback(lua_State *L)
|
||||
{
|
||||
@@ -1142,6 +1168,8 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
|
||||
API_FCT(gettext);
|
||||
API_FCT(get_video_drivers);
|
||||
API_FCT(get_screen_info);
|
||||
API_FCT(get_min_supp_proto);
|
||||
API_FCT(get_max_supp_proto);
|
||||
API_FCT(do_async_callback);
|
||||
}
|
||||
|
||||
|
@@ -137,6 +137,12 @@ private:
|
||||
|
||||
static int l_get_video_drivers(lua_State *L);
|
||||
|
||||
//version compatibility
|
||||
static int l_get_min_supp_proto(lua_State *L);
|
||||
|
||||
static int l_get_max_supp_proto(lua_State *L);
|
||||
|
||||
|
||||
// async
|
||||
static int l_do_async_callback(lua_State *L);
|
||||
|
||||
|
Reference in New Issue
Block a user