Simplify room out/in placements
This commit is contained in:
+8
-8
@@ -78,20 +78,20 @@ shuffleRoomPos rm = do
|
||||
newPos <- shuffle $ _rmPos rm
|
||||
return $ rm & rmPos .~ newPos
|
||||
|
||||
doInPlacements :: (IM.IntMap [Placement], GenWorld) -> GenWorld
|
||||
doInPlacements (im, w) =
|
||||
let (gw, rms) = mapAccumR (doRoomInPlacements im) w (_genRooms w)
|
||||
doInPlacements :: GenWorld -> GenWorld
|
||||
doInPlacements w =
|
||||
let (gw, rms) = mapAccumR doRoomInPlacements w (_genRooms w)
|
||||
in gw & genRooms .~ rms
|
||||
|
||||
doRoomInPlacements :: IM.IntMap [Placement] -> GenWorld -> Room -> (GenWorld, Room)
|
||||
doRoomInPlacements im w rm = foldr f (w, rm) $ _rmInPmnt rm
|
||||
doRoomInPlacements :: GenWorld -> Room -> (GenWorld, Room)
|
||||
doRoomInPlacements w rm = foldr f (w, rm) $ _rmInPmnt rm
|
||||
where
|
||||
f (InPlacement plf i) (w', r') = fst $ placeSpot (w', r') (plf (w') $ im IM.! i)
|
||||
f plf (w', r') = fst $ placeSpot (w', r') (plf (w'))
|
||||
|
||||
doOutPlacements :: GenWorld -> (IM.IntMap [Placement], GenWorld)
|
||||
doOutPlacements :: GenWorld -> GenWorld
|
||||
doOutPlacements w =
|
||||
let ((pmnts, gw), rms) = mapAccumR doRoomOutPlacements (IM.empty, w) (_genRooms w)
|
||||
in (pmnts, gw & genRooms .~ rms)
|
||||
in gw & genRooms .~ rms & genPmnt .~ pmnts
|
||||
|
||||
doRoomOutPlacements ::
|
||||
(IM.IntMap [Placement], GenWorld) ->
|
||||
|
||||
Reference in New Issue
Block a user