diff options
author | kwolekr <kwolekr@minetest.net> | 2013-07-08 20:21:09 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2013-07-08 20:21:09 -0400 |
commit | e1a13608d85818cae8543e72f78659dcdfa99fc1 (patch) | |
tree | 3b91f76a2117732f7ce970b07932dac5db5df143 | |
parent | eedb29346e38105f4da2a39536542d9242c70b8d (diff) | |
download | minetest-e1a13608d85818cae8543e72f78659dcdfa99fc1.tar.gz minetest-e1a13608d85818cae8543e72f78659dcdfa99fc1.tar.bz2 minetest-e1a13608d85818cae8543e72f78659dcdfa99fc1.zip |
Revert "Fix serverlist not beeing escaped correctly"
This reverts commit 39d03148e5d98ef5f9a31b131a79ff2bbd71a877.
-rw-r--r-- | builtin/mainmenu.lua | 24 | ||||
-rw-r--r-- | builtin/mainmenu_helper.lua | 8 | ||||
-rw-r--r-- | src/guiFormSpecMenu.cpp | 3 |
3 files changed, 19 insertions, 16 deletions
diff --git a/builtin/mainmenu.lua b/builtin/mainmenu.lua index 564521f92..d5092cda6 100644 --- a/builtin/mainmenu.lua +++ b/builtin/mainmenu.lua @@ -52,6 +52,12 @@ function render_favourite(spec) details = details .. " " end + if spec.port ~= nil then + text = text .. ":" .. spec.port:trim() + else + text = text .. ":??" + end + return text end @@ -113,8 +119,6 @@ function cleanup_path(temppath) return temppath end --------------------------------------------------------------------------------- - function menu.set_texture(identifier,gamedetails) local texture_set = false if menu.texturepack ~= nil and gamedetails ~= nil then @@ -700,7 +704,10 @@ function tabbuilder.handle_multiplayer_buttons(fields) end if event.typ == "CHG" then - local address = menu.favorites[event.index].address + local address = menu.favorites[event.index].name + if address == nil then + address = menu.favorites[event.index].address + end local port = menu.favorites[event.index].port if address ~= nil and @@ -1138,7 +1145,8 @@ 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,10 +1189,9 @@ 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 @@ -1214,8 +1221,7 @@ end function tabbuilder.tab_singleplayer() local index = engine.setting_get("main_menu_singleplayer_world_idx") - if index == nil or - #menu.filtered_game_list_raw() == 0 then + if index == nil then index = 0 end diff --git a/builtin/mainmenu_helper.lua b/builtin/mainmenu_helper.lua index 25ad072fd..a204b4a37 100644 --- a/builtin/mainmenu_helper.lua +++ b/builtin/mainmenu_helper.lua @@ -77,11 +77,9 @@ function fs_escape_string(text) text = newtext end - text = string.gsub(text,"\\","\\\\") - text = string.gsub(text,"%]","\\]") - text = string.gsub(text,"%[","\\[") - text = string.gsub(text,";","\\;") - text = string.gsub(text,",","\\,") + text = text:gsub("%[","\\%[") + text = text:gsub("]","\\]") + text = text:gsub(";","\\;") end return text end diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 1a99d696b..abe519798 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -611,7 +611,7 @@ void GUIFormSpecMenu::parseTextList(parserData* data,std::string element) { std::vector<std::string> v_pos = split(parts[0],','); std::vector<std::string> v_geom = split(parts[1],','); std::string name = parts[2]; - std::vector<std::string> items = split(parts[3],',',true); + std::vector<std::string> items = split(parts[3],','); std::string str_initial_selection = ""; std::string str_transparent = "false"; @@ -1352,7 +1352,6 @@ void GUIFormSpecMenu::parseBox(parserData* data,std::string element) { } void GUIFormSpecMenu::parseElement(parserData* data,std::string element) { - //some prechecks if (element == "") return; |