From bc4dc80c0166bd5c7f645bec1472101e4a9e20bb Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 15 Apr 2016 04:13:53 +0200 Subject: Mainmenu: Still support favorites if send_pre_v25_init is disabled @SmallJoker has noted a bug that servers from the (local) main menu favorites list can't be opened. This commit fixes the bug by disabling any main menu based protocol checks for servers from the favorite list. Also, it fixes a second bug that happens when a server from the public serverlist doesn't send its supported protocol versions, most likely because its running a minetest older than commit [1]. Then we have shown an error msg that the server has enforced one specific protocol version. This was most likely not the case. Of course, we can't do anything better than do an assumption on the protocol versions if they are not known. That assumption should however be closest to the most often occuring case as possible. Also, some little cleanups. [1]: 5a0ed780f56a5225b3d7c5f64099586e390e5f39 "Server: announce MIN/MAX protocol version supported to serverlist. Client: check serverlist" --- builtin/mainmenu/tab_simple_main.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'builtin/mainmenu/tab_simple_main.lua') diff --git a/builtin/mainmenu/tab_simple_main.lua b/builtin/mainmenu/tab_simple_main.lua index b32418938..cb64b73f6 100644 --- a/builtin/mainmenu/tab_simple_main.lua +++ b/builtin/mainmenu/tab_simple_main.lua @@ -122,6 +122,7 @@ local function main_button_handler(tabview, fields, name, tabdata) asyncOnlineFavourites() else menudata.favorites = core.get_favorites("local") + menudata.favorites_is_public = false end return true end @@ -149,12 +150,14 @@ local function main_button_handler(tabview, fields, name, tabdata) if fav_idx ~= nil and fav_idx <= #menudata.favorites and menudata.favorites[fav_idx].address == fields["te_address"] and menudata.favorites[fav_idx].port == fields["te_port"] then + local fav = menudata.favorites[fav_idx] - gamedata.servername = menudata.favorites[fav_idx].name - gamedata.serverdescription = menudata.favorites[fav_idx].description + gamedata.servername = fav.name + gamedata.serverdescription = fav.description - if not is_server_protocol_compat_or_error(menudata.favorites[fav_idx].proto_min, - menudata.favorites[fav_idx].proto_max) then + if menudata.favorites_is_public and + not is_server_protocol_compat_or_error( + fav.proto_min, fav.proto_max) then return true end else @@ -192,6 +195,7 @@ local function on_activate(type,old_tab,new_tab) asyncOnlineFavourites() else menudata.favorites = core.get_favorites("local") + menudata.favorites_is_public = false end end -- cgit v1.2.3