Skip to content

Commit 76b0f7e

Browse files
committed
internal/caravan/trade.lua use new obfuscate_value() API
Verified that this gives identical results to the unmodified code.
1 parent de12a18 commit 76b0f7e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/caravan/trade.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ local function is_ethical_product(item, animal_ethics, wood_ethics)
315315
(not wood_ethics or not common.has_wood(item))
316316
end
317317

318-
local function make_choice_text(value, desc)
318+
local function make_choice_text(value, threshold, desc)
319319
return {
320-
{width=STATUS_COL_WIDTH+VALUE_COL_WIDTH, rjustify=true, text=common.obfuscate_value(value)},
320+
{width=STATUS_COL_WIDTH+VALUE_COL_WIDTH, rjustify=true, text=common.obfuscate_value(value, threshold)},
321321
{gap=2, text=desc},
322322
}
323323
end
@@ -328,6 +328,7 @@ function Trade:cache_choices(list_idx, trade_bins)
328328
local goodflags = trade.goodflag[list_idx]
329329
local trade_bins_choices, notrade_bins_choices = {}, {}
330330
local parent_data
331+
local cache_threshold = common.get_threshold(common.get_broker_skill())
331332
for item_idx, item in ipairs(trade.good[list_idx]) do
332333
local goodflag = goodflags[item_idx]
333334
if not goodflag.contained then
@@ -374,7 +375,7 @@ function Trade:cache_choices(list_idx, trade_bins)
374375
search_key=search_key,
375376
icon=curry(get_entry_icon, data),
376377
data=data,
377-
text=make_choice_text(data.value, desc),
378+
text=make_choice_text(data.value, cache_threshold, desc),
378379
}
379380
if not data.update_container_fn then
380381
table.insert(trade_bins_choices, choice)

0 commit comments

Comments
 (0)