Pass room id rather than room during placement

This commit is contained in:
2025-09-25 22:31:09 +01:00
parent f5a3486f72
commit 9ed6d75853
4 changed files with 40 additions and 38 deletions
+7 -6
View File
@@ -80,7 +80,7 @@ shuffleRoomPos rm = do
return $ rm & rmPos .~ newPos
doInPlacements :: GenWorld -> GenWorld
doInPlacements w = foldl' (\gw (i,(_,f)) -> placeSpot' i gw (f gw)) w
doInPlacements w = foldl' (\gw (i,(_,f)) -> placeSpot i gw (f gw)) w
. sortOn (fst.snd)
$ foldMap g $ w ^. genRooms
where
@@ -97,15 +97,16 @@ doIndividualPlacements :: GenWorld -> GenWorld
doIndividualPlacements gw = foldl' doRoomPlacements gw (_genRooms gw)
doRoomPlacements :: GenWorld -> Room -> GenWorld
doRoomPlacements w rm = foldl' (placeSpot' i) (w & genRooms . ix i . rmPmnts .~ mempty)
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'
--placeSpot' :: Int -> GenWorld -> Placement -> GenWorld
--placeSpot' = placeSpot
--placeSpot' i gw x =
-- let (gw',r') = placeSpot (gw,(gw ^?! genRooms . ix i)) x
-- in gw' & genRooms . ix i .~ r'
setupWorldBounds :: World -> World
setupWorldBounds w =