maybe fix the level parser

This commit is contained in:
Kistaro Windrider 2023-12-20 11:33:59 -08:00
parent 2a61e8b5d6
commit fbd9f97429
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -857,18 +857,21 @@ function load_level(levelfile)
distance = 0
lframe = 0
freeze = 0
leveldone = false
current_level = {}
local found_eol = false
for row in all(csv(levelfile)) do
local x = current_level[row[1]]
if row[2] == "eol" then
found_eol = true
assert(x==nil, "events on eol frame")
row[1] = eol
current_level[row[1]] = eol
else
add(x, row)
row.next = x
currentlevel[row[1]]=row
end
row[1]=x
end
leveldone = false
assert found_eol
end
function level_frame()
@ -882,9 +885,10 @@ function level_frame()
current_level = nil
return true
else
for c in all(cbs) do
assert(c[1] == distance)
level_events[c[2]](unpack(c.params, 3))
while cbs do
assert(cbs[1] == distance)
level_events[cbs[2]](unpack(cbs, 3))
cbs=cbs.next
end
end
end