diff options
author | HybridDog <adresse_test@t-online.de> | 2015-05-30 16:18:09 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-06-09 16:44:43 +0200 |
commit | 05f4e9ee08f93b17c3dbaf2b6a1022cc28a226ce (patch) | |
tree | 378b3dc80ceb54d1cab8b861bc6b079ee34257ad | |
parent | e4817454338d43b853a52ce757b69df122e864c1 (diff) | |
download | minetest-05f4e9ee08f93b17c3dbaf2b6a1022cc28a226ce.tar.gz minetest-05f4e9ee08f93b17c3dbaf2b6a1022cc28a226ce.tar.bz2 minetest-05f4e9ee08f93b17c3dbaf2b6a1022cc28a226ce.zip |
More reliable serverlist behaviour
-> remember the previously loaded serverlist, and use if new one failed
-> show a "loading" serverlist
-rw-r--r-- | builtin/mainmenu/common.lua | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua index d6e2588fa..6126c61a4 100644 --- a/builtin/mainmenu/common.lua +++ b/builtin/mainmenu/common.lua @@ -234,7 +234,13 @@ end -------------------------------------------------------------------------------- function asyncOnlineFavourites() - menudata.favorites = {} + if not menudata.public_known then + menudata.public_known = {{ + name = fgettext("Loading..."), + description = fgettext("Try reenabling public serverlist and check your internet connection.") + }} + end + menudata.favorites = menudata.public_known core.handle_async( function(param) return core.get_favorites("online") @@ -242,11 +248,15 @@ function asyncOnlineFavourites() nil, function(result) if core.setting_getbool("public_serverlist") then - menudata.favorites = order_favorite_list(result) + local favs = order_favorite_list(result) + if favs[1] then + menudata.public_known = favs + menudata.favorites = menudata.public_known + end core.event_handler("Refresh") end end - ) + ) end -------------------------------------------------------------------------------- |