Fix bug with favs

This commit is contained in:
Jean-Patrick Guerrero 2022-06-23 02:30:54 +02:00
parent 5d6ce3be18
commit f2b4c960ad
2 changed files with 459 additions and 458 deletions

View File

@ -369,7 +369,7 @@ local function rcp_fields(player, data, fields)
local fav = is_fav(data) local fav = is_fav(data)
if #data.favs < i3.settings.max_favs and not fav then if #data.favs < i3.settings.max_favs and not fav then
insert(data.favs, data.query_item) insert(data.favs, fmt("_%s", data.query_item))
elseif fav then elseif fav then
remove(data.favs, fav) remove(data.favs, fav)
end end

View File

@ -1398,7 +1398,8 @@ local function get_favs(fs, data)
label(data.inv_width + 0.4, data.yoffset + 0.4, ES"Bookmarks") label(data.inv_width + 0.4, data.yoffset + 0.4, ES"Bookmarks")
for i = 1, #data.favs do for i = 1, #data.favs do
local item = data.favs[i] local name = data.favs[i]
local item = sub(name, 2)
local X = data.inv_width - 0.7 + (i * 1.2) local X = data.inv_width - 0.7 + (i * 1.2)
local Y = data.yoffset + 0.8 local Y = data.yoffset + 0.8
@ -1406,7 +1407,7 @@ local function get_favs(fs, data)
image(X, Y, btn_size, btn_size, PNG.slot) image(X, Y, btn_size, btn_size, PNG.slot)
end end
item_image_button(X, Y, btn_size, btn_size, item, item, "") item_image_button(X, Y, btn_size, btn_size, item, name, "")
end end
end end