From a986d0478d2bed19b1949910af7f92f35f55c044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez-Cerezo?= Date: Thu, 11 Apr 2019 11:48:11 +0200 Subject: Added command-line switch to add world image --- main.lua | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/main.lua b/main.lua index f87a338..d16eedf 100644 --- a/main.lua +++ b/main.lua @@ -96,7 +96,7 @@ dofile("nodedb.lua") function parse_args(argv) local i = 1 local no_trains = false - local datapath, mappath + local datapath, mappath, worldimage while i <= #argv do local a = argv[i] if (a == "-m") or (a == "--map-file") then @@ -109,15 +109,23 @@ function parse_args(argv) elseif (a == "-t") or (a == "--no-trains") then -- do not draw trains no_trains = true + elseif (a == "-w") or (a == "--world-image") then + -- overlay over world image + i = i+1 + if not argv[i] then + error(("missing filename after `%s'"):format(a)) + end + worldimage = argv[i] else datapath = a end + i = i + 1 end - return datapath, mappath, no_trains + return datapath, mappath, no_trains, worldimage end -datapath, mappath, no_trains = parse_args(arg) +datapath, mappath, no_trains, worldimage = parse_args(arg) -- Load saves local file, err = io.open(datapath.."advtrains", "r") @@ -160,13 +168,13 @@ else ]]) end -if wimg then +if worldimage then local wimx = -(wimresx*wimscale/2) local wimy = -(wimresy*wimscale/2) local wimw = wimresx*wimscale local wimh = wimresy*wimscale - svgfile:write('') + svgfile:write('') end local function writec(text) -- cgit v1.2.3