summaryrefslogtreecommitdiff
path: root/shop2
diff options
context:
space:
mode:
Diffstat (limited to 'shop2')
-rw-r--r--shop2/disp.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/shop2/disp.lua b/shop2/disp.lua
index 9417dfe..a2fad5e 100644
--- a/shop2/disp.lua
+++ b/shop2/disp.lua
@@ -43,24 +43,15 @@ local function disp_shopscreen(items)
-- 123456789012345678901234567890123456789012345678901234567
-- 0 1 2 3 4 5
- -- local function fmt_row(m,y, stock,price,adr,name, colour)
- local function fmt_row(y, idesc, amt, colour)
- colour = colour or colors.cyan
- printseq(mon) {
- {1,y}, colors.white, pad(amt,5),
- {8,y}, colors.yellow, pad(idesc.price,3), colors.lightGray, "kst",
- {16,y}, colour, idesc.adr,
- {22,y}, colour, idesc.hname,
- }
- end
-
-
-- sort alphabetically by address
-- todo: more intuitive sort, once more things are for sale
local adrs = {}
for adr in pairs(items) do table.insert(adrs,adr) end
table.sort(adrs)
-
+
+
+ -- do all processing and counting BEFORE clearing monitor
+ -- to avoid flickering
mon.clear()
mon.setTextScale(0.5)
@@ -69,6 +60,15 @@ local function disp_shopscreen(items)
{1,2}, colors.lightGray, "Stock Price Adr. Name",
}
+ local function fmt_row(y, idesc, amt, colour)
+ colour = colour or colors.cyan
+ printseq(mon) {
+ {1,y}, colors.white, pad(amt,5),
+ {8,y}, colors.yellow, pad(idesc.price,3), colors.lightGray, "kst",
+ {16,y}, colour, idesc.adr,
+ {22,y}, colour, idesc.hname,
+ }
+ end
for ix,adr in ipairs(adrs) do
local idesc = items[adr]
fmt_row(ix+2, idesc)