summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2013-08-20 22:38:14 +0200
committerKahrl <kahrl@gmx.net>2013-09-11 00:08:56 +0200
commit3c4734d69a44aea133e5bd7df66a5dedb87785fb (patch)
treef3961c8855c0d864b672ae79857de9b993c3e95c /builtin
parentda9fe6485134ec81cc3628b1bc4847c3b2226c76 (diff)
downloadminetest-3c4734d69a44aea133e5bd7df66a5dedb87785fb.tar.gz
minetest-3c4734d69a44aea133e5bd7df66a5dedb87785fb.tar.bz2
minetest-3c4734d69a44aea133e5bd7df66a5dedb87785fb.zip
Change mainmenu texture handling + small misc changes
Texture names must now be escaped in formspec elements image[], background[], image_button[], image_button_exit[]. Instead of special-case handling of texture loading (and unloading which was missing) in guiFormSpecMenu.cpp, use the newly created ISimpleTextureSource interface which is a minimal subset of ITextureSource. There is an implementation of this interface used by GUIEngine (MenuTextureSource). Fix an off-by-one bug in unescape_string; it caused requests for a texture called "\0".
Diffstat (limited to 'builtin')
-rw-r--r--builtin/gamemgr.lua6
-rw-r--r--builtin/mainmenu.lua5
-rw-r--r--builtin/mm_menubar.lua5
-rw-r--r--builtin/modstore.lua2
4 files changed, 11 insertions, 7 deletions
diff --git a/builtin/gamemgr.lua b/builtin/gamemgr.lua
index 8409bff03..7a5e9790f 100644
--- a/builtin/gamemgr.lua
+++ b/builtin/gamemgr.lua
@@ -225,7 +225,8 @@ function gamemgr.tab()
if current_game.menuicon_path ~= nil and
current_game.menuicon_path ~= "" then
retval = retval ..
- "image[5.8,-0.25;2,2;" .. current_game.menuicon_path .. "]"
+ "image[5.8,-0.25;2,2;" ..
+ engine.formspec_escape(current_game.menuicon_path) .. "]"
end
retval = retval ..
@@ -251,7 +252,8 @@ function gamemgr.dialog_edit_game()
if current_game.menuicon_path ~= nil and
current_game.menuicon_path ~= "" then
retval = retval ..
- "image[5.25,0;2,2;" .. current_game.menuicon_path .. "]"
+ "image[5.25,0;2,2;" ..
+ engine.formspec_escape(current_game.menuicon_path) .. "]"
end
retval = retval ..
diff --git a/builtin/mainmenu.lua b/builtin/mainmenu.lua
index 787a5e280..5a1b6e929 100644
--- a/builtin/mainmenu.lua
+++ b/builtin/mainmenu.lua
@@ -1047,16 +1047,17 @@ function tabbuilder.tab_texture_packs()
return retval ..
menu.render_texture_pack_list(list) ..
";" .. index .. "]" ..
- "image[0.65,0.25;4.0,3.7;"..(screenfile or no_screenshot).."]"..
+ "image[0.65,0.25;4.0,3.7;"..engine.formspec_escape(screenfile or no_screenshot).."]"..
"textarea[1.0,3.25;3.7,1.5;;"..engine.formspec_escape(infotext or "")..";]"
end
--------------------------------------------------------------------------------
function tabbuilder.tab_credits()
+ local logofile = menu.defaulttexturedir .. "logo.png"
return "vertlabel[0,-0.5;CREDITS]" ..
"label[0.5,3;Minetest " .. engine.get_version() .. "]" ..
"label[0.5,3.3;http://minetest.net]" ..
- "image[0.5,1;" .. menu.defaulttexturedir .. "logo.png]" ..
+ "image[0.5,1;" .. engine.formspec_escape(logofile) .. "]" ..
"textlist[3.5,-0.25;8.5,5.8;list_credits;" ..
"#FFFF00" .. fgettext("Core Developers") .."," ..
"Perttu Ahola (celeron55) <celeron55@gmail.com>,"..
diff --git a/builtin/mm_menubar.lua b/builtin/mm_menubar.lua
index faba92a8f..c3ddbb289 100644
--- a/builtin/mm_menubar.lua
+++ b/builtin/mm_menubar.lua
@@ -51,7 +51,8 @@ function menubar.refresh()
menubar.formspec = menubar.formspec ..
"image_button[" .. buttonpos .. ",5.7;1.3,1.3;" ..
- gamemgr.games[i].menuicon_path .. ";" .. btn_name .. ";;true;false]"
+ engine.formspec_escape(gamemgr.games[i].menuicon_path) .. ";" ..
+ btn_name .. ";;true;false]"
else
local part1 = gamemgr.games[i].id:sub(1,5)
@@ -75,4 +76,4 @@ function menubar.refresh()
table.insert(menubar.buttons,toadd)
end
-end \ No newline at end of file
+end
diff --git a/builtin/modstore.lua b/builtin/modstore.lua
index 2f967c9b1..43f7759ad 100644
--- a/builtin/modstore.lua
+++ b/builtin/modstore.lua
@@ -227,7 +227,7 @@ function modstore.getmodlist(list)
end
retval = retval .. "image[0,".. screenshot_ypos .. ";3,2;" ..
- list.data[i].texturename .. "]"
+ engine.formspec_escape(list.data[i].texturename) .. "]"
--title + author
retval = retval .."label[2.75," .. screenshot_ypos .. ";" ..