module Dodge.Room.CheckConsistency
  where
import Dodge.LevelGen.Data
import Dodge.Graph
import Dodge.RoomLink

linksOnPath :: Room -> Bool
linksOnPath r = all pointOnPath linkPoints
  where
    linkPoints = map (fst . lnkPosDir) $ _rmLinks r
    pointOnPath p = elem p $ concatMap flat2 $ _rmPath r
    flat2 (x,y) = [x,y]

pathConnected :: Room -> Bool
pathConnected = isSingleton . pairsToSCC . _rmPath
  where
    isSingleton [_] = True
    isSingleton _  = False
