Add log when generating layout

This commit is contained in:
2022-05-20 21:15:44 +01:00
parent 20d041fc59
commit da302aad0c
16 changed files with 155 additions and 94 deletions
+18 -13
View File
@@ -37,8 +37,9 @@ padSucWithDoors (Node x xs) = Node x (map (padWithAno [SpecificRoom thetree]) xs
thetree = do
thecor <- shuffleLinks corridor
takeOne
[ return (UseAll door)
, treeFromPost [PassDown door, PassDown thecor] (UseAll door)
[ (return (UseAll door),TreeSubLabelling "door" Nothing)
, (treeFromPost [PassDown door, PassDown thecor] (UseAll door)
,TreeSubLabelling "twoDoors" Nothing)
]
{- Add one to three corridors between each parent-child link of a tree of annotations. -}
@@ -54,30 +55,34 @@ roomThenCorridor theRoom = fmap
(shuffleLinks corridor)
{- | Create a random room tree structure from a list of annotations. -}
anoToRoomTree :: [Annotation] -> State StdGen (SubCompTree Room,String)
anoToRoomTree :: [Annotation] -> State StdGen (LabSubCompTree Room)
anoToRoomTree anos = case anos of
[AnoApplyInt i f] -> f i
[AnoApplyInt' i f str] -> f i <&> (,str)
_ -> fmap (,"") $ anoToRoomTree' anos
-- [AnoApplyInt' i f str] -> f i <&> (,TreeSubLabelling str Nothing)
(SpecificRoom rt:_) -> rt
[PassthroughLockKeyLists i ls ks] -> do
(functionlockroom,randomitemidentity) <- takeOne ls
lr' <- functionlockroom i
ii <- randomitemidentity
let lr = fst lr'
keyroom' <- fromJust $ lookup ii ks
let keyroom = fst keyroom'
(return $ overwriteLabel 0 UseNone lr [keyroom]
) <&> (,TreeSubLabelling ("PassthroughLockKeyLists-"++show ii)
(Just $ treeFromPost [snd lr'] (snd keyroom'))
)
_ -> (,TreeSubLabelling "" Nothing) <$> anoToRoomTree' anos
{- | Create a random room tree structure from a list of annotations. -}
anoToRoomTree' :: [Annotation] -> State StdGen (SubCompTree Room)
anoToRoomTree' anos = case anos of
-- [AnoApplyInt i f] -> f i
[ChainAnos ass] -> do
rms <- mapM anoToRoomTree' ass
return $ chainUses rms
[PassthroughLockKeyLists i ls ks] -> do
(functionlockroom,randomitemidentity) <- takeOne ls
lr <- functionlockroom i
ii <- randomitemidentity
keyroom <- fromJust $ lookup ii ks
return $ overwriteLabel 0 UseNone lr [keyroom]
[OrAno as] -> do
a <- takeOne as
anoToRoomTree' a
[Corridor] -> pure . UseAll <$> shuffleLinks corridor
(SpecificRoom rt:_) -> rt
(BossAno cr : _) -> do
br <- bossRoom cr
branchRectWith . pure . fmap PassDown $ treeFromPost [corridor,corridor] br