Skip to content

Commit 002bff7

Browse files
author
Thomas Bleher
committed
lint: verify that each line contains only one jump
As discussed in #231 and #238, TipToi pens handle a jump after all other actions (even if they are earlier in the list). If there are multiple jumps, only the last has an effect. This lint check verifies that a GME only contains one jump, and that the jump is the last action. This check is true for all GMEs published by Ravensburger.
1 parent 9313000 commit 002bff7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Lint.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ lintTipToi :: TipToiFile -> Segments -> IO ()
1212
lintTipToi tt segments = do
1313
let hyps = [ (hyp1, "play indicies are correct")
1414
, (hyp2, "media indicies are correct")
15+
, (hyp3, "at most one jump per line, as last action")
1516
]
1617
forM_ hyps $ \(hyp, desc) -> do
1718
let wrong = filter (not . hyp) (concat (mapMaybe snd (ttScripts tt)))
@@ -46,6 +47,13 @@ lintTipToi tt segments = do
4647
hyp2 :: Line ResReg -> Bool
4748
hyp2 (Line _ _ _ mi) = all (< media_count) mi
4849

50+
max_one_jump_at_end [] = True
51+
max_one_jump_at_end (Jump x : acts) = null acts
52+
max_one_jump_at_end (x : acts) = max_one_jump_at_end acts
53+
54+
hyp3 :: Line ResReg -> Bool
55+
hyp3 (Line _ _ as _) = max_one_jump_at_end as
56+
4957
report :: Segment -> Segment -> IO ()
5058
report (o1,l1,d1) (o2,l2,d2)
5159
| l1 == l2 && o1 == o2

0 commit comments

Comments
 (0)