Fix incorrect creation of unused links pos

This commit is contained in:
2022-03-08 09:48:45 +00:00
parent 59e6f433ff
commit 8179a2aa4f
8 changed files with 35 additions and 35 deletions
+5 -4
View File
@@ -37,8 +37,9 @@ randomPadCorridors (Node x xs) = do
return $ treeFromTrunk (replicate n [Corridor]) (Node x xs')
{- | Add a corridor to a random out-link of a room. -}
roomThenCorridor :: RandomGen g => Room -> State g (SubCompTree Room)
roomThenCorridor theRoom = fmap (\r -> Node (PassDown theRoom) [(pure . UseAll) r])
(randomiseOutLinks corridor)
roomThenCorridor theRoom = fmap
(\r -> Node (PassDown theRoom) [(pure . UseAll) r])
(shuffleLinks corridor)
{- | Create a random room tree structure from a list of annotations. -}
anoToRoomTree :: RandomGen g => [Annotation g] -> State g (SubCompTree Room)
@@ -62,7 +63,7 @@ anoToRoomTree anos = case anos of
[OrAno as] -> do
a <- takeOne as
anoToRoomTree a
[Corridor] -> pure . UseAll <$> randomiseOutLinks corridor
[Corridor] -> pure . UseAll <$> shuffleLinks corridor
[AirlockAno] -> airlock >>= roomThenCorridor
[FirstWeapon] -> do
branchWP <- branchRectWith weaponRoom
@@ -77,4 +78,4 @@ anoToRoomTree anos = case anos of
_ -> do
w <- state $ randomR (100,400)
h <- state $ randomR (200,400)
fmap (pure . UseAll) . randomiseOutLinks $ roomRectAutoLinks w h
fmap (pure . UseAll) . shuffleLinks $ roomRectAutoLinks w h