aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-06-30 19:58:06 +0200
committerest31 <MTest31@outlook.com>2015-06-30 20:09:29 +0200
commit29b0dc89e6789bce8663b74feeb32f1961a784d7 (patch)
treea9f4c316134373e39c37e995bef68f74aa8dac69 /builtin/mainmenu
parent85f3d575ec3d99ef2ce680d4a2546e4d31327d83 (diff)
downloadminetest-29b0dc89e6789bce8663b74feeb32f1961a784d7.tar.gz
minetest-29b0dc89e6789bce8663b74feeb32f1961a784d7.tar.bz2
minetest-29b0dc89e6789bce8663b74feeb32f1961a784d7.zip
Fix single click world select
Diffstat (limited to 'builtin/mainmenu')
-rw-r--r--builtin/mainmenu/common.lua16
-rw-r--r--builtin/mainmenu/tab_server.lua2
-rw-r--r--builtin/mainmenu/tab_singleplayer.lua2
3 files changed, 10 insertions, 10 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua
index bcb075f99..5cd16a9ea 100644
--- a/builtin/mainmenu/common.lua
+++ b/builtin/mainmenu/common.lua
@@ -307,7 +307,7 @@ function menu_worldmt(selected, setting, value)
local filename = world.path .. DIR_DELIM .. "world.mt"
local world_conf = Settings(filename)
- if value then
+ if value ~= nil then
if not world_conf:write() then
core.log("error", "Failed to write world config file")
end
@@ -320,14 +320,14 @@ function menu_worldmt(selected, setting, value)
end
end
-function menu_worldmt_legacy()
- local modes = {"creative_mode", "enable_damage"}
- for _, mode in pairs(modes) do
- local mode = menu_worldmt(selected, ""..mode.."")
- if mode then
- core.setting_set(""..mode.."", mode)
+function menu_worldmt_legacy(selected)
+ local modes_names = {"creative_mode", "enable_damage"}
+ for _, mode_name in pairs(modes_names) do
+ local mode_val = menu_worldmt(selected, mode_name)
+ if mode_val ~= nil then
+ core.setting_set(mode_name, mode_val)
else
- menu_worldmt(selected, ""..mode.."", core.setting_get(""..mode..""))
+ menu_worldmt(selected, mode_name, core.setting_get(mode_name))
end
end
end
diff --git a/builtin/mainmenu/tab_server.lua b/builtin/mainmenu/tab_server.lua
index 2362d32a1..3459f3f2f 100644
--- a/builtin/mainmenu/tab_server.lua
+++ b/builtin/mainmenu/tab_server.lua
@@ -69,7 +69,7 @@ local function main_button_handler(this, fields, name, tabdata)
local event = core.explode_textlist_event(fields["srv_worlds"])
local selected = core.get_textlist_index("srv_worlds")
- menu_worldmt_legacy()
+ menu_worldmt_legacy(selected)
if event.type == "DCL" then
world_doubleclick = true
diff --git a/builtin/mainmenu/tab_singleplayer.lua b/builtin/mainmenu/tab_singleplayer.lua
index 916b0c188..a7cf5120c 100644
--- a/builtin/mainmenu/tab_singleplayer.lua
+++ b/builtin/mainmenu/tab_singleplayer.lua
@@ -107,7 +107,7 @@ local function main_button_handler(this, fields, name, tabdata)
local event = core.explode_textlist_event(fields["sp_worlds"])
local selected = core.get_textlist_index("sp_worlds")
- menu_worldmt_legacy()
+ menu_worldmt_legacy(selected)
if event.type == "DCL" then
world_doubleclick = true