aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-04-12 00:05:55 +0100
committerrubenwardy <rw@rubenwardy.com>2020-04-12 00:12:18 +0100
commit3833396cfad7289b8c38ab64b69885b409d993ce (patch)
tree2e8e58152a8dd121d7a0d3ff60d37ed0c6763bb2 /builtin/mainmenu
parentaf2e6a6a10121cf971d4ce4c33d523b6dc037d31 (diff)
downloadminetest-3833396cfad7289b8c38ab64b69885b409d993ce.tar.gz
minetest-3833396cfad7289b8c38ab64b69885b409d993ce.tar.bz2
minetest-3833396cfad7289b8c38ab64b69885b409d993ce.zip
Fix delayed error message in start game tab
Diffstat (limited to 'builtin/mainmenu')
-rw-r--r--builtin/mainmenu/tab_local.lua53
1 files changed, 24 insertions, 29 deletions
diff --git a/builtin/mainmenu/tab_local.lua b/builtin/mainmenu/tab_local.lua
index 0969bccfb..cd6cbea46 100644
--- a/builtin/mainmenu/tab_local.lua
+++ b/builtin/mainmenu/tab_local.lua
@@ -207,40 +207,35 @@ local function main_button_handler(this, fields, name, tabdata)
local selected = core.get_textlist_index("sp_worlds")
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
- if core.settings:get_bool("enable_server") then
- if selected ~= nil and gamedata.selected_world ~= 0 then
- gamedata.playername = fields["te_playername"]
- gamedata.password = fields["te_passwd"]
- gamedata.port = fields["te_serverport"]
- gamedata.address = ""
-
- core.settings:set("port",gamedata.port)
- if fields["te_serveraddr"] ~= nil then
- core.settings:set("bind_address",fields["te_serveraddr"])
- end
+ 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
+ -- 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
- gamedata.errormessage =
- fgettext("No world created or selected!")
+ if core.settings:get_bool("enable_server") then
+ gamedata.playername = fields["te_playername"]
+ gamedata.password = fields["te_passwd"]
+ gamedata.port = fields["te_serverport"]
+ gamedata.address = ""
+
+ core.settings:set("port",gamedata.port)
+ if fields["te_serveraddr"] ~= nil then
+ core.settings:set("bind_address",fields["te_serveraddr"])
end
else
- if selected ~= nil and gamedata.selected_world ~= 0 then
- gamedata.singleplayer = true
- core.start()
- else
- gamedata.errormessage =
- fgettext("No world created or selected!")
- end
- return true
+ gamedata.singleplayer = true
end
+
+ core.start()
+ return true
end
if fields["world_create"] ~= nil then