summaryrefslogtreecommitdiff
path: root/shop2
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-01-07 05:29:58 +0000
committerubq323 <ubq323@ubq323.website>2023-01-07 05:29:58 +0000
commit0d59ecdd2b9715b20e6cba6c0ea79a74af15a1d7 (patch)
treecbb6e4464bdc7a38ca960535ae5f74208f9fe54b /shop2
parent8bc14682ea2e05d03ec3f4546ea5295f53fe4679 (diff)
shop2
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)