diff options
author | est31 <MTest31@outlook.com> | 2016-04-15 04:13:53 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2016-04-15 14:40:31 +0200 |
commit | bc4dc80c0166bd5c7f645bec1472101e4a9e20bb (patch) | |
tree | dd09c0072a3ab4361cc447853e17d14bcd1fef00 /builtin/mainmenu/tab_multiplayer.lua | |
parent | d82c5da0dccb1f30250725d17c3f373aacdda0e2 (diff) | |
download | minetest-bc4dc80c0166bd5c7f645bec1472101e4a9e20bb.tar.gz minetest-bc4dc80c0166bd5c7f645bec1472101e4a9e20bb.tar.bz2 minetest-bc4dc80c0166bd5c7f645bec1472101e4a9e20bb.zip |
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"
Diffstat (limited to 'builtin/mainmenu/tab_multiplayer.lua')
-rw-r--r-- | builtin/mainmenu/tab_multiplayer.lua | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/builtin/mainmenu/tab_multiplayer.lua b/builtin/mainmenu/tab_multiplayer.lua index 06d8791f0..f3ba122fc 100644 --- a/builtin/mainmenu/tab_multiplayer.lua +++ b/builtin/mainmenu/tab_multiplayer.lua @@ -102,22 +102,22 @@ local function main_button_handler(tabview, fields, name, tabdata) local event = core.explode_table_event(fields["favourites"]) if event.type == "DCL" then if event.row <= #menudata.favorites then - if not is_server_protocol_compat_or_error(menudata.favorites[event.row].proto_min, - menudata.favorites[event.row].proto_max) then + local fav = menudata.favorites[event.row] + if menudata.favorites_is_public and + not is_server_protocol_compat_or_error( + fav.proto_min, fav.proto_max) then return true end - gamedata.address = menudata.favorites[event.row].address - gamedata.port = menudata.favorites[event.row].port + gamedata.address = fav.address + gamedata.port = fav.port gamedata.playername = fields["te_name"] if fields["te_pwd"] ~= nil then gamedata.password = fields["te_pwd"] end gamedata.selected_world = 0 - if menudata.favorites ~= nil then - gamedata.servername = menudata.favorites[event.row].name - gamedata.serverdescription = menudata.favorites[event.row].description - end + gamedata.servername = fav.name + gamedata.serverdescription = fav.description if gamedata.address ~= nil and gamedata.port ~= nil then @@ -188,6 +188,7 @@ local function main_button_handler(tabview, fields, name, tabdata) asyncOnlineFavourites() else menudata.favorites = core.get_favorites("local") + menudata.favorites_is_public = false end tabdata.fav_selected = nil return true @@ -197,7 +198,7 @@ local function main_button_handler(tabview, fields, name, tabdata) local current_favourite = core.get_table_index("favourites") if current_favourite == nil then return end core.delete_favorite(current_favourite) - menudata.favorites = order_favorite_list(core.get_favorites()) + menudata.favorites = core.get_favorites("local") tabdata.fav_selected = nil core.setting_set("address","") @@ -221,11 +222,13 @@ local function main_button_handler(tabview, fields, name, tabdata) menudata.favorites[fav_idx].address == fields["te_address"] and menudata.favorites[fav_idx].port == fields["te_port"] then - gamedata.servername = menudata.favorites[fav_idx].name - gamedata.serverdescription = menudata.favorites[fav_idx].description + local fav = menudata.favorites[fav_idx] + 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 @@ -252,6 +255,7 @@ local function on_change(type,old_tab,new_tab) asyncOnlineFavourites() else menudata.favorites = core.get_favorites("local") + menudata.favorites_is_public = false end end |