Start updating rooms "in place" during placement
This commit is contained in:
File diff suppressed because one or more lines are too long
+14
-3
@@ -89,14 +89,25 @@ doRoomInPlacements w rm = foldr f (w, rm) $ _rmInPmnt rm
|
|||||||
f plf (w', r') = placeSpot (w', r') (plf w')
|
f plf (w', r') = placeSpot (w', r') (plf w')
|
||||||
|
|
||||||
doIndividualPlacements :: GenWorld -> GenWorld
|
doIndividualPlacements :: GenWorld -> GenWorld
|
||||||
doIndividualPlacements gw =
|
doIndividualPlacements gw = foldl' doRoomPlacements' gw (_genRooms gw)
|
||||||
let (gw', rms) = mapAccumR doRoomPlacements gw (_genRooms gw)
|
-- let (gw', rms) = mapAccumR doRoomPlacements gw (_genRooms gw)
|
||||||
in gw' & genRooms .~ rms
|
-- in gw' & genRooms .~ rms
|
||||||
|
|
||||||
doRoomPlacements :: GenWorld -> Room -> (GenWorld, Room)
|
doRoomPlacements :: GenWorld -> Room -> (GenWorld, Room)
|
||||||
doRoomPlacements w rm = foldl' placeSpot (w, rm & rmPmnts .~ mempty)
|
doRoomPlacements w rm = foldl' placeSpot (w, rm & rmPmnts .~ mempty)
|
||||||
$ _rmPmnts rm
|
$ _rmPmnts rm
|
||||||
|
|
||||||
|
doRoomPlacements' :: GenWorld -> Room -> GenWorld
|
||||||
|
doRoomPlacements' w rm = foldl' (placeSpot' i) (w & genRooms . ix i . rmPmnts .~ mempty)
|
||||||
|
$ _rmPmnts rm
|
||||||
|
where
|
||||||
|
i = rm ^?! rmMID . _Just
|
||||||
|
|
||||||
|
placeSpot' :: Int -> GenWorld -> Placement -> GenWorld
|
||||||
|
placeSpot' i gw x =
|
||||||
|
let (gw',r') = placeSpot (gw,(gw ^?! genRooms . ix i)) x
|
||||||
|
in gw' & genRooms . ix i .~ r'
|
||||||
|
|
||||||
setupWorldBounds :: World -> World
|
setupWorldBounds :: World -> World
|
||||||
setupWorldBounds w =
|
setupWorldBounds w =
|
||||||
w & cWorld . cwGen . cwgWorldBounds
|
w & cWorld . cwGen . cwgWorldBounds
|
||||||
|
|||||||
Reference in New Issue
Block a user