mirror of
https://github.com/minetest/minetest.git
synced 2024-08-18 20:44:16 +02:00
Fix startup after removing last game (#13015)
This commit is contained in:
parent
291c42ed57
commit
b85831e389
@ -86,9 +86,12 @@ local function init_globals()
|
||||
menudata.worldlist:add_sort_mechanism("alphabetic", sort_worlds_alphabetic)
|
||||
menudata.worldlist:set_sortmode("alphabetic")
|
||||
|
||||
if not core.settings:get("menu_last_game") then
|
||||
local default_game = core.settings:get("default_game") or "minetest"
|
||||
core.settings:set("menu_last_game", default_game)
|
||||
local gameid = core.settings:get("menu_last_game")
|
||||
local game = gameid and pkgmgr.find_by_gameid(gameid)
|
||||
if not game then
|
||||
gameid = core.settings:get("default_game") or "minetest"
|
||||
game = pkgmgr.find_by_gameid(gameid)
|
||||
core.settings:set("menu_last_game", gameid)
|
||||
end
|
||||
|
||||
mm_game_theme.init()
|
||||
@ -115,11 +118,8 @@ local function init_globals()
|
||||
|
||||
-- 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_game_theme.reset()
|
||||
end
|
||||
if tv_main.current_tab == "local" and not game then
|
||||
mm_game_theme.reset()
|
||||
end
|
||||
|
||||
ui.set_default("maintab")
|
||||
|
Loading…
Reference in New Issue
Block a user