Minor cleanup

This commit is contained in:
2021-11-15 02:16:17 +00:00
parent e93fa10a97
commit 59dc24aff6
5 changed files with 21 additions and 17 deletions
+8 -6
View File
@@ -29,15 +29,16 @@ posRms :: [ConvexPoly]
posRms _ _ [] Empty = return $ Just []
posRms bounds (rtoadd,_) [] (Node (r,i) ts :<| tseq)
= fmap (finalLinksUpdate rtoadd:) <$> posRms bounds (r,i) ts tseq
posRms bounds (r,i) (t@(Node (_,i') _):ts) tseq = do
posRms bounds (parent,i) (t@(Node (_,i') _):ts) tseq = do
putStr $ "Trying to place room " ++ show i' ++ ": "
tryLinks (0::Int) (_rmLinks $ doRoomShift r)
--tryLinks (0::Int) (_rmLinks $ doRoomShift parent)
tryLinks (0::Int) (_rmLinks parent)
where
tryLinks _ [] = do
putStrLn "all links tried"
return Nothing
tryLinks j (l:ls)
| clipping = tryLinks (j+1) ls
| clipping = tryLinks (j+1) ls
| otherwise = do
putStrLn $ "placing at link " ++ show j
mayrs <- posRms (convexBounds ++ bounds) newr ts (tseq |> shiftedt')
@@ -47,10 +48,11 @@ posRms bounds (r,i) (t@(Node (_,i') _):ts) tseq = do
where
convexBounds = map pointsToPoly $ _rmBound r'
clipping = or (convexPolysOverlap <$> convexBounds <*> bounds)
newr = (lnkEff l $ r & rmLinks %~ delete l & rmPos %~ (uncurry (OutLink j) l :)
newr = (lnkEff l $ parent & rmLinks %~ delete l & rmPos %~ (uncurry (OutLink j) l :)
, i)
(Node (r',_) _) = applyToRoot (first $ shiftRoomToLink l) t
shiftedt' = applyToRoot (first $ shiftRoomShiftToLink l) t
l' = shiftLinkBy (_rmShift parent) l
(Node (r',_) _) = applyToRoot (first $ shiftRoomToLink l') t
shiftedt' = applyToRoot (first $ shiftRoomShiftToLink l') t
lnkEff :: (Point2,Float) -> Room -> Room
lnkEff x rm = case _rmLinkEff rm of