Move to using RoomLink datatype
This commit is contained in:
@@ -7,6 +7,7 @@ module Dodge.Tree.Shift
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.Room.Link
|
||||
import Dodge.Tree.Polymorphic
|
||||
import Dodge.RoomLink
|
||||
import Geometry.ConvexPoly
|
||||
import Geometry.Data
|
||||
import Padding
|
||||
@@ -54,15 +55,15 @@ posRms bounds parenti@(parent,_) numChild (t@(Node childi _):ts) tseq = do
|
||||
where
|
||||
convexBounds = map pointsToPoly $ _rmBound r'
|
||||
clipping = or (convexPolysOverlap <$> convexBounds <*> bounds)
|
||||
updateparent rm = doLnkEff l $ rm & rmOutLinks %~ delete l & rmPos %~ (uncurry (UsedOutLink numChild) l :)
|
||||
updateparent rm = doLnkEff (lnkPosDir l) $ rm & rmOutLinks %~ delete l & rmPos %~ (uncurry (UsedOutLink numChild) (lnkPosDir l) :)
|
||||
l' = shiftLinkBy (_rmShift parent) l
|
||||
r' = doRoomShift . fst $ rootLabel shiftedt
|
||||
updatechild rm = rm & rmInLinks %~ delete il
|
||||
& rmPos %~ ( (uncurry (UsedInLink 0) il:)
|
||||
. (map (uncurry UnusedLink) (_rmOutLinks rm ++ newInLinks) ++) )
|
||||
& rmPos %~ ( (uncurry (UsedInLink 0) (lnkPosDir il):)
|
||||
. (map (uncurry UnusedLink . lnkPosDir) (_rmOutLinks rm ++ newInLinks) ++) )
|
||||
where
|
||||
newInLinks = delete il $ _rmInLinks rm
|
||||
shiftedt = applyToRoot (first $ updatechild . shiftRoomShiftToLink' l' il) t
|
||||
shiftedt = applyToRoot (first $ updatechild . shiftRoomShiftToLink' (lnkPosDir l') (lnkPosDir il)) t
|
||||
|
||||
printColumns :: [Int] -> [String] -> IO ()
|
||||
printColumns (i:is) (s:strs) = putStr (rightPad i ' ' s) >> printColumns is strs
|
||||
|
||||
Reference in New Issue
Block a user