Work on more complicated terminals

This commit is contained in:
2022-05-31 13:30:27 +01:00
parent 79b3a86520
commit b54864bbda
13 changed files with 159 additions and 64 deletions
+10
View File
@@ -21,6 +21,7 @@ module Dodge.PlacementSpot
, twoRoomPoss
, isUnusedLnkType
, rprBoolShift
, rprShift
, rprBool
, shiftInBy
, resetPLUse
@@ -71,6 +72,15 @@ resetPLUse (PSPos f g fallback) = PSPos f' g fallback
f' rp = fmap (second (rpPlacementUse .~ 0)) . f rp
resetPLUse _ = error "Tried to reset _rpPlacementUse of non PSPos placement"
rprShift
:: (RoomPos -> Room -> Maybe (Point2,Float))
-> PlacementSpot
rprShift t = PSPos f (const id) Nothing
where
f rp r = case t rp r of
Just (p,a) -> Just (PS p a, rp & rpPlacementUse +~ 1)
Nothing -> Nothing
rprBoolShift :: (RoomPos -> Room -> Bool)
-> ((Point2,Float) -> (Point2,Float))
-> PlacementSpot