Make Placement into a product type
This commit is contained in:
@@ -155,13 +155,13 @@ mntLSCond shp ps =
|
||||
|
||||
-- note that this perhaps pushes the vshape light out too far
|
||||
|
||||
mntLight :: Point2 -> Point2 -> Placement
|
||||
mntLight a b = RandomPlacement $ do
|
||||
mntLight :: RandomGen g => Point2 -> Point2 -> State g Placement
|
||||
mntLight a b = do
|
||||
shp <- takeOne [vShape, iShape, lShape, jShape, liShape]
|
||||
return $ mntLS shp a (addZ 90 b)
|
||||
|
||||
mntLightLnkCond :: PlacementSpot -> Placement
|
||||
mntLightLnkCond ps = RandomPlacement $ do
|
||||
mntLightLnkCond :: RandomGen g => PlacementSpot -> State g Placement
|
||||
mntLightLnkCond ps = do
|
||||
shp <- takeOne [vShape, lShape, jShape, liShape]
|
||||
return $ mntLSCond (fmap (fmap $ colorSH black) shp) ps
|
||||
|
||||
|
||||
@@ -33,19 +33,9 @@ placeSpot (w, rm) plmnt = case plmnt of
|
||||
Placement{_plSpot = PSPos extract eff fallback} ->
|
||||
placeSpotUsingLink w rm plmnt extract eff fallback
|
||||
Placement{} -> placePlainPSSpot w rm plmnt shift
|
||||
RandomPlacement rplmnt -> placeRandomPlacement rplmnt w rm
|
||||
where
|
||||
shift = _rmShift rm
|
||||
|
||||
placeRandomPlacement ::
|
||||
State StdGen Placement ->
|
||||
GenWorld ->
|
||||
Room ->
|
||||
((GenWorld, Room), [Placement])
|
||||
placeRandomPlacement rplmnt w rm = placeSpot (w & gwWorld . randGen .~ g, rm) plmnt'
|
||||
where
|
||||
(plmnt', g) = runState rplmnt (_randGen (_gwWorld w))
|
||||
|
||||
placePlainPSSpot ::
|
||||
GenWorld ->
|
||||
Room ->
|
||||
|
||||
@@ -25,4 +25,4 @@ shiftPlacement shift plmnt = case plmnt of
|
||||
Placement{} ->
|
||||
plmnt & plSpot %~ shiftPSBy shift
|
||||
& plIDCont %~ fmap (fmap (fmap $ shiftPlacement shift))
|
||||
RandomPlacement rpl -> RandomPlacement $ fmap (shiftPlacement shift) rpl
|
||||
-- RandomPlacement rpl -> RandomPlacement $ fmap (shiftPlacement shift) rpl
|
||||
|
||||
Reference in New Issue
Block a user