Make get_setting outside loop (performance)
This commit is contained in:
parent
c655ff32e2
commit
660d460af2
15
ui/inbox.lua
15
ui/inbox.lua
@ -47,6 +47,9 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
|
|||||||
|
|
||||||
mail.message_drafts[name] = nil
|
mail.message_drafts[name] = nil
|
||||||
|
|
||||||
|
local unread_color_enable = mail.get_setting(name, "unreadcolorenable")
|
||||||
|
local cc_color_enable = mail.get_setting(name, "cccolorenable")
|
||||||
|
|
||||||
if #messages > 0 then
|
if #messages > 0 then
|
||||||
for _, message in ipairs(messages) do
|
for _, message in ipairs(messages) do
|
||||||
local selected_id = 0
|
local selected_id = 0
|
||||||
@ -60,28 +63,28 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if selected_id > 0 then
|
if selected_id > 0 then
|
||||||
if not message.read and mail.get_setting(name, "unreadcolorenable") then
|
if not message.read and unread_color_enable then
|
||||||
if not mail.player_in_list(name, message.to) and mail.get_setting(name, "cccolorenable") then
|
if not mail.player_in_list(name, message.to) and cc_color_enable then
|
||||||
formspec[#formspec + 1] = ",#A39E5D"
|
formspec[#formspec + 1] = ",#A39E5D"
|
||||||
else
|
else
|
||||||
formspec[#formspec + 1] = ",#A39E19"
|
formspec[#formspec + 1] = ",#A39E19"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not mail.player_in_list(name, message.to) and mail.get_setting(name, "cccolorenable") then
|
if not mail.player_in_list(name, message.to) and cc_color_enable then
|
||||||
formspec[#formspec + 1] = ",#899888"
|
formspec[#formspec + 1] = ",#899888"
|
||||||
else
|
else
|
||||||
formspec[#formspec + 1] = ",#466432"
|
formspec[#formspec + 1] = ",#466432"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not message.read and mail.get_setting(name, "unreadcolorenable") then
|
if not message.read and unread_color_enable then
|
||||||
if not mail.player_in_list(name, message.to) and mail.get_setting(name, "cccolorenable") then
|
if not mail.player_in_list(name, message.to) and cc_color_enable then
|
||||||
formspec[#formspec + 1] = ",#FFD788"
|
formspec[#formspec + 1] = ",#FFD788"
|
||||||
else
|
else
|
||||||
formspec[#formspec + 1] = ",#FFD700"
|
formspec[#formspec + 1] = ",#FFD700"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not mail.player_in_list(name, message.to) and mail.get_setting(name, "cccolorenable") then
|
if not mail.player_in_list(name, message.to) and cc_color_enable then
|
||||||
formspec[#formspec + 1] = ",#CCCCDD"
|
formspec[#formspec + 1] = ",#CCCCDD"
|
||||||
else
|
else
|
||||||
formspec[#formspec + 1] = ","
|
formspec[#formspec + 1] = ","
|
||||||
|
Loading…
x
Reference in New Issue
Block a user