This commit is contained in:
2022-06-11 13:37:26 +01:00
parent db8c30dac8
commit 9c9ec9c553
+1 -12
View File
@@ -9,7 +9,6 @@ module Dodge.Room.Link
, shiftLinkBy
, doRoomShift
, shuffleLinks
, chooseOneInLink
, restrictRMInLinksPD
) where
import Dodge.ShiftPoint
@@ -23,21 +22,11 @@ import Data.Tile
import Dodge.RoomLink
import Control.Lens
import qualified Data.Set as S
chooseOneInLink :: RandomGen g => Room -> State g Room
chooseOneInLink r = restrictToFstInLink <$> shuffleLinks r
--import qualified Data.Set as S
restrictRMInLinksPD :: ((Point2,Float) -> Bool) -> Room -> Room
restrictRMInLinksPD f = rmLinks %~ restrictLinkType InLink f
restrictToFstInLink :: Room -> Room
restrictToFstInLink = rmLinks %~ f
where
f (rl:xs) | S.member InLink (_rlType rl) = rl : restrictLinkType InLink (const False) xs
| otherwise = rl : f xs
f [] = []
{- Shuffle the order of all links of a room randomly.
- Note this does not change their types. -}
shuffleLinks :: RandomGen g => Room -> State g Room