diff options
author | sapier <Sapier at GMX dot net> | 2013-07-08 23:45:14 +0200 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2013-07-08 19:58:17 -0400 |
commit | 39d03148e5d98ef5f9a31b131a79ff2bbd71a877 (patch) | |
tree | cc91012b059d938707d21b3c934aeab1b5c88073 /builtin | |
parent | f419f66546b72ed265a5a4dc96569aeee8880d7a (diff) | |
download | minetest-39d03148e5d98ef5f9a31b131a79ff2bbd71a877.tar.gz minetest-39d03148e5d98ef5f9a31b131a79ff2bbd71a877.tar.bz2 minetest-39d03148e5d98ef5f9a31b131a79ff2bbd71a877.zip |
Fix serverlist not beeing escaped correctly
Always use address for server
Fix first (empty) element beeing selected after deleting last world
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/mainmenu.lua | 24 | ||||
-rw-r--r-- | builtin/mainmenu_helper.lua | 8 |
2 files changed, 14 insertions, 18 deletions
diff --git a/builtin/mainmenu.lua b/builtin/mainmenu.lua index 30cff823e..3e8ec6057 100644 --- a/builtin/mainmenu.lua +++ b/builtin/mainmenu.lua @@ -52,12 +52,6 @@ function render_favourite(spec) details = details .. " " end - if spec.port ~= nil then - text = text .. ":" .. spec.port:trim() - else - text = text .. ":??" - end - return text end @@ -119,6 +113,8 @@ function cleanup_path(temppath) return temppath end +-------------------------------------------------------------------------------- + function menu.set_texture(identifier,gamedetails) local texture_set = false if menu.texturepack ~= nil then @@ -696,10 +692,7 @@ function tabbuilder.handle_multiplayer_buttons(fields) end if event.typ == "CHG" then - local address = menu.favorites[event.index].name - if address == nil then - address = menu.favorites[event.index].address - end + local address = menu.favorites[event.index].address local port = menu.favorites[event.index].port if address ~= nil and @@ -1137,8 +1130,7 @@ function tabbuilder.tab_multiplayer() retval = retval .. "," .. render_favourite(menu.favorites[i]) end end - - print("cfav: " .. dump(menu.fav_selected)) + if menu.fav_selected ~= nil then retval = retval .. ";" .. menu.fav_selected .. "]" else @@ -1181,9 +1173,10 @@ function tabbuilder.tab_server() retval = retval .. "," .. menu.worldlist[i].name .. " \\[" .. menu.worldlist[i].gameid .. "\\]" end + retval = retval .. ";" .. index .. "]" + else + retval = retval .. ";0]" end - - retval = retval .. ";" .. index .. "]" return retval end @@ -1213,7 +1206,8 @@ end function tabbuilder.tab_singleplayer() local index = engine.setting_get("main_menu_singleplayer_world_idx") - if index == nil then + if index == nil or + #menu.filtered_game_list_raw() == 0 then index = 0 end diff --git a/builtin/mainmenu_helper.lua b/builtin/mainmenu_helper.lua index a204b4a37..25ad072fd 100644 --- a/builtin/mainmenu_helper.lua +++ b/builtin/mainmenu_helper.lua @@ -77,9 +77,11 @@ function fs_escape_string(text) text = newtext end - text = text:gsub("%[","\\%[") - text = text:gsub("]","\\]") - text = text:gsub(";","\\;") + text = string.gsub(text,"\\","\\\\") + text = string.gsub(text,"%]","\\]") + text = string.gsub(text,"%[","\\[") + text = string.gsub(text,";","\\;") + text = string.gsub(text,",","\\,") end return text end |