Cleanup. Add room-wise random placement spots
This commit is contained in:
@@ -33,6 +33,8 @@ data PlacementSpot
|
||||
| PSLnk { _psLinkTest :: (Point2,Float) -> Bool
|
||||
, _psLinkShift :: (Point2,Float) -> (Point2,Float)
|
||||
}
|
||||
| PSRoomRand
|
||||
{ _psRoomRandPointNum :: Int }
|
||||
data Placement = Placement
|
||||
{ _placementSpot :: PlacementSpot
|
||||
, _psType :: PSType
|
||||
@@ -68,6 +70,14 @@ jps0 pst = Just . Placement (PS (V2 0 0) 0) pst
|
||||
ps0j :: PSType -> Placement -> Placement
|
||||
ps0j pst plmnt = Placement (PS (V2 0 0) 0) pst (const $ Just plmnt)
|
||||
|
||||
addPlmnt :: Placement -> Placement -> Placement
|
||||
addPlmnt pl (PlacementUsingPos p f) = PlacementUsingPos p (fmap (addPlmnt pl) f)
|
||||
addPlmnt pl (RandomPlacement rp) = RandomPlacement $ fmap (addPlmnt pl) rp
|
||||
addPlmnt pl (Placement ps pt f) = Placement ps pt (fmap g f)
|
||||
where
|
||||
g Nothing = Just pl
|
||||
g (Just pl') = Just $ addPlmnt pl pl'
|
||||
|
||||
makeLenses ''PSType
|
||||
makeLenses ''PlacementSpot
|
||||
makeLenses ''Placement
|
||||
|
||||
Reference in New Issue
Block a user