forked from Mirrorlandia_minetest/minetest
Fix delayed error message in start game tab
This commit is contained in:
parent
af2e6a6a10
commit
3833396cfa
@ -207,8 +207,20 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
local selected = core.get_textlist_index("sp_worlds")
|
local selected = core.get_textlist_index("sp_worlds")
|
||||||
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
||||||
|
|
||||||
|
if selected == nil or gamedata.selected_world == 0 then
|
||||||
|
gamedata.errormessage =
|
||||||
|
fgettext("No world created or selected!")
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Update last game
|
||||||
|
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
|
||||||
|
if world then
|
||||||
|
local game = pkgmgr.find_by_gameid(world.gameid)
|
||||||
|
core.settings:set("menu_last_game", game.id)
|
||||||
|
end
|
||||||
|
|
||||||
if core.settings:get_bool("enable_server") then
|
if core.settings:get_bool("enable_server") then
|
||||||
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"]
|
||||||
@ -218,30 +230,13 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
if fields["te_serveraddr"] ~= nil then
|
if fields["te_serveraddr"] ~= nil then
|
||||||
core.settings:set("bind_address",fields["te_serveraddr"])
|
core.settings:set("bind_address",fields["te_serveraddr"])
|
||||||
end
|
end
|
||||||
|
|
||||||
--update last game
|
|
||||||
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
|
|
||||||
if world then
|
|
||||||
local game = pkgmgr.find_by_gameid(world.gameid)
|
|
||||||
core.settings:set("menu_last_game", game.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
core.start()
|
|
||||||
else
|
else
|
||||||
gamedata.errormessage =
|
|
||||||
fgettext("No world created or selected!")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if selected ~= nil and gamedata.selected_world ~= 0 then
|
|
||||||
gamedata.singleplayer = true
|
gamedata.singleplayer = true
|
||||||
|
end
|
||||||
|
|
||||||
core.start()
|
core.start()
|
||||||
else
|
|
||||||
gamedata.errormessage =
|
|
||||||
fgettext("No world created or selected!")
|
|
||||||
end
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if fields["world_create"] ~= nil then
|
if fields["world_create"] ~= nil then
|
||||||
local create_world_dlg = create_create_world_dlg(true)
|
local create_world_dlg = create_create_world_dlg(true)
|
||||||
|
Loading…
Reference in New Issue
Block a user