forked from Mirrorlandia_minetest/minetest
Fix remnant bugs on mainmenu
- Stop attempting to start a world when no world's created/selected in server tab - Better world's indexes handling between subgames lists
This commit is contained in:
parent
1a1774a105
commit
c3dead719a
@ -113,12 +113,12 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
world_doubleclick or
|
world_doubleclick or
|
||||||
fields["key_enter"] then
|
fields["key_enter"] then
|
||||||
local selected = core.get_textlist_index("srv_worlds")
|
local selected = core.get_textlist_index("srv_worlds")
|
||||||
if selected ~= nil then
|
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
||||||
|
if selected ~= nil and gamedata.selected_world ~= 0 then
|
||||||
gamedata.playername = fields["te_playername"]
|
gamedata.playername = fields["te_playername"]
|
||||||
gamedata.password = fields["te_passwd"]
|
gamedata.password = fields["te_passwd"]
|
||||||
gamedata.port = fields["te_serverport"]
|
gamedata.port = fields["te_serverport"]
|
||||||
gamedata.address = ""
|
gamedata.address = ""
|
||||||
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
|
||||||
|
|
||||||
core.setting_set("port",gamedata.port)
|
core.setting_set("port",gamedata.port)
|
||||||
if fields["te_serveraddr"] ~= nil then
|
if fields["te_serveraddr"] ~= nil then
|
||||||
@ -133,8 +133,11 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
end
|
end
|
||||||
|
|
||||||
core.start()
|
core.start()
|
||||||
return true
|
else
|
||||||
|
gamedata.errormessage =
|
||||||
|
fgettext("No world created or selected!")
|
||||||
end
|
end
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields["world_create"] ~= nil then
|
if fields["world_create"] ~= nil then
|
||||||
|
@ -40,10 +40,13 @@ local function singleplayer_refresh_gamebar()
|
|||||||
menudata.worldlist:set_filtercriteria(gamemgr.games[j].id)
|
menudata.worldlist:set_filtercriteria(gamemgr.games[j].id)
|
||||||
local index = filterlist.get_current_index(menudata.worldlist,
|
local index = filterlist.get_current_index(menudata.worldlist,
|
||||||
tonumber(core.setting_get("mainmenu_last_selected_world")))
|
tonumber(core.setting_get("mainmenu_last_selected_world")))
|
||||||
local selected = core.get_textlist_index("sp_worlds")
|
|
||||||
if not index or index < 1 then
|
if not index or index < 1 then
|
||||||
index = math.min(core.get_textlist_index("sp_worlds"),
|
local selected = core.get_textlist_index("sp_worlds")
|
||||||
#menudata.worldlist:get_list())
|
if selected ~= nil and selected < #menudata.worldlist:get_list() then
|
||||||
|
index = selected
|
||||||
|
else
|
||||||
|
index = #menudata.worldlist:get_list()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
menu_worldmt_legacy(index)
|
menu_worldmt_legacy(index)
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user