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