aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZughy <63455151+Zughy@users.noreply.github.com>2020-12-28 12:56:58 +0000
committerGitHub <noreply@github.com>2020-12-28 13:56:58 +0100
commit55dba1bc6d90c90ddd77d60f4760e34e28a6382f (patch)
tree4b2d7be34f9374e9d0c7be66baaa1724d6ac63c1
parent8f72d4b2940f0bd5486e38bd58127d14a1762be8 (diff)
downloadminetest-55dba1bc6d90c90ddd77d60f4760e34e28a6382f.tar.gz
minetest-55dba1bc6d90c90ddd77d60f4760e34e28a6382f.tar.bz2
minetest-55dba1bc6d90c90ddd77d60f4760e34e28a6382f.zip
Display Minetest header when menu_last_game value isn't available anymore (#10751)
-rw-r--r--builtin/mainmenu/init.lua10
-rw-r--r--builtin/mainmenu/tab_local.lua1
2 files changed, 11 insertions, 0 deletions
diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua
index 2fc0ae64c..656d1d149 100644
--- a/builtin/mainmenu/init.lua
+++ b/builtin/mainmenu/init.lua
@@ -106,6 +106,16 @@ local function init_globals()
if last_tab and tv_main.current_tab ~= last_tab then
tv_main:set_tab(last_tab)
end
+
+ -- In case the folder of the last selected game has been deleted,
+ -- display "Minetest" as a header
+ if tv_main.current_tab == "local" then
+ local game = pkgmgr.find_by_gameid(core.settings:get("menu_last_game"))
+ if game == nil then
+ mm_texture.reset()
+ end
+ end
+
ui.set_default("maintab")
tv_main:show()
diff --git a/builtin/mainmenu/tab_local.lua b/builtin/mainmenu/tab_local.lua
index 1aee246fc..2eb4752bc 100644
--- a/builtin/mainmenu/tab_local.lua
+++ b/builtin/mainmenu/tab_local.lua
@@ -18,6 +18,7 @@
local enable_gamebar = PLATFORM ~= "Android"
local current_game, singleplayer_refresh_gamebar
+
if enable_gamebar then
function current_game()
local last_game_id = core.settings:get("menu_last_game")