aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/mainmenu')
-rw-r--r--builtin/mainmenu/tab_server.lua6
-rw-r--r--builtin/mainmenu/tab_singleplayer.lua9
2 files changed, 11 insertions, 4 deletions
diff --git a/builtin/mainmenu/tab_server.lua b/builtin/mainmenu/tab_server.lua
index c1dd6f501..154a54cc7 100644
--- a/builtin/mainmenu/tab_server.lua
+++ b/builtin/mainmenu/tab_server.lua
@@ -74,6 +74,7 @@ local function main_button_handler(this, fields, name, tabdata)
if event.type == "CHG" then
core.setting_set("mainmenu_last_selected_world",
menudata.worldlist:get_raw_index(core.get_textlist_index("srv_worlds")))
+ return true
end
end
@@ -83,14 +84,17 @@ local function main_button_handler(this, fields, name, tabdata)
if fields["cb_creative_mode"] then
core.setting_set("creative_mode", fields["cb_creative_mode"])
+ return true
end
if fields["cb_enable_damage"] then
core.setting_set("enable_damage", fields["cb_enable_damage"])
+ return true
end
if fields["cb_server_announce"] then
core.setting_set("server_announce", fields["cb_server_announce"])
+ return true
end
if fields["start_server"] ~= nil or
@@ -111,9 +115,11 @@ local function main_button_handler(this, fields, name, tabdata)
--update last game
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
+
local game,index = gamemgr.find_by_gameid(world.gameid)
core.setting_set("menu_last_game",game.id)
core.start()
+ return true
end
end
diff --git a/builtin/mainmenu/tab_singleplayer.lua b/builtin/mainmenu/tab_singleplayer.lua
index 244221c37..1eab94da3 100644
--- a/builtin/mainmenu/tab_singleplayer.lua
+++ b/builtin/mainmenu/tab_singleplayer.lua
@@ -112,9 +112,8 @@ local function main_button_handler(this, fields, name, tabdata)
if event.type == "CHG" then
core.setting_set("mainmenu_last_selected_world",
menudata.worldlist:get_raw_index(core.get_textlist_index("sp_worlds")))
+ return true
end
-
- return true
end
if menu_handle_key_up_down(fields,"sp_worlds","mainmenu_last_selected_world") then
@@ -135,9 +134,11 @@ local function main_button_handler(this, fields, name, tabdata)
world_doubleclick or
fields["key_enter"] then
local selected = core.get_textlist_index("sp_worlds")
+
if selected ~= nil then
- gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
- gamedata.singleplayer = true
+ gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
+ gamedata.singleplayer = true
+
core.start()
end
return true