Bugfix when minetest freezes if you have no quests

This commit is contained in:
TeTpaAka 2015-03-01 09:33:01 +01:00
parent c19d696e6c
commit 020203285c

View File

@ -351,7 +351,7 @@ function quests.create_formspec(playername, tab)
quests.formspec_lists[playername].list = {} quests.formspec_lists[playername].list = {}
tab = tab or quests.formspec_lists[playername].tab or "1" tab = tab or quests.formspec_lists[playername].tab or "1"
if (tab == "1") then if (tab == "1") then
questlist = quests.active_quests[playername] questlist = quests.active_quests[playername] or {}
elseif (tab == "2") then elseif (tab == "2") then
questlist = quests.successfull_quests[playername] or {} questlist = quests.successfull_quests[playername] or {}
elseif (tab == "3") then elseif (tab == "3") then
@ -402,11 +402,15 @@ function quests.create_info(playername, questname)
local formspec = "size[7,6.5]" .. local formspec = "size[7,6.5]" ..
"label[0.5,0.5;" "label[0.5,0.5;"
formspec = formspec .. quests.registered_quests[questname].title .. "]" .. if (questname) then
"textarea[.5,1.5;6,4.5;description;;" .. quests.registered_quests[questname].description .. "]" formspec = formspec .. quests.registered_quests[questname].title .. "]" ..
"textarea[.5,1.5;6,4.5;description;;" .. quests.registered_quests[questname].description .. "]"
if (quests.formspec_lists[playername].tab == "1") then if (quests.formspec_lists[playername].tab == "1") then
formspec = formspec .. "button[.5,6;3,.7;abort;Abort quest]" formspec = formspec .. "button[.5,6;3,.7;abort;Abort quest]"
end
else
formspec = formspec .. "No quest specified.]"
end end
formspec = formspec .. "button[3.25,6;3,.7;return;Return]" formspec = formspec .. "button[3.25,6;3,.7;return;Return]"
return formspec return formspec