Redo PathFrom name change

This commit is contained in:
2022-07-01 18:48:33 +01:00
parent 516cc6d29e
commit 4d1f1547bc
4 changed files with 16 additions and 16 deletions
+3 -3
View File
@@ -61,12 +61,12 @@ data RPLinkStatus
| UnusedLink { _rplsType :: S.Set RoomLinkType } | UnusedLink { _rplsType :: S.Set RoomLinkType }
| NotLink | NotLink
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show)
data PathEdge = PathFromEdge CardinalPoint Int data PathFromEdge = PathFromEdge CardinalPoint Int
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show)
data RoomPosType data RoomPosType
= RoomPosOnPath {_onPathEdges :: S.Set PathEdge} = RoomPosOnPath {_onPathFromEdges :: S.Set PathFromEdge}
| RoomPosOffPath {_offPathEdges :: S.Set PathEdge} | RoomPosOffPath {_offPathFromEdges :: S.Set PathFromEdge}
| RoomPosExLink | RoomPosExLink
| RoomPosLab Int | RoomPosLab Int
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show)
+8 -8
View File
@@ -3,8 +3,8 @@ module Dodge.PlacementSpot
( atFstLnkOut ( atFstLnkOut
, rpIsOnPath , rpIsOnPath
, rpIsOffPath , rpIsOffPath
, rpOffPathEdge , rpOffPathFromEdge
, rpOnPathEdge , rpOnPathFromEdge
, useUnusedLnk , useUnusedLnk
, psRandRanges , psRandRanges
, useRoomPosCond , useRoomPosCond
@@ -82,16 +82,16 @@ rpIsOffPath = any f . _rpType
where where
f RoomPosOffPath {} = True f RoomPosOffPath {} = True
f _ = False f _ = False
rpOffPathEdge :: PathEdge -> RoomPos -> Bool rpOffPathFromEdge :: PathFromEdge -> RoomPos -> Bool
rpOffPathEdge pe = any f . _rpType rpOffPathFromEdge pe = any f . _rpType
where where
f rt = maybe False (pe `elem`) (rt ^? offPathEdges) f rt = maybe False (pe `elem`) (rt ^? offPathFromEdges)
-- test whether a roomPos is on the path with a given from edge value -- test whether a roomPos is on the path with a given from edge value
rpOnPathEdge :: PathEdge -> RoomPos -> Bool rpOnPathFromEdge :: PathFromEdge -> RoomPos -> Bool
rpOnPathEdge pe = any f . _rpType rpOnPathFromEdge pe = any f . _rpType
where where
f rt = maybe False (pe `elem`) (rt ^? onPathEdges) f rt = maybe False (pe `elem`) (rt ^? onPathFromEdges)
resetPLUse :: PlacementSpot -> PlacementSpot resetPLUse :: PlacementSpot -> PlacementSpot
resetPLUse (PSPos f g fallback) = PSPos f' g fallback resetPLUse (PSPos f g fallback) = PSPos f' g fallback
+3 -3
View File
@@ -24,8 +24,8 @@ blockPillar w' h' = ps0jPushPS (aline tl tr)
$ ps0jPushPS (aline br bl) $ ps0jPushPS (aline br bl)
$ sps0 (aline bl tl) $ sps0 (aline bl tl)
where where
w = w' - 9 w = w' - 10
h = h' - 9 h = h' - 10
tl = V2 (-w) h tl = V2 (-w) h
tr = V2 w h tr = V2 w h
br = V2 w (-h) br = V2 w (-h)
@@ -70,7 +70,7 @@ roomPillarsSquare = do
where where
makepill edge = sps (rprBool $ \rp _ -> t edge rp) smallPillar makepill edge = sps (rprBool $ \rp _ -> t edge rp) smallPillar
t edge rp = any (f edge) (_rpType rp) && _rpPlacementUse rp == 0 t edge rp = any (f edge) (_rpType rp) && _rpPlacementUse rp == 0
f edge rpt = maybe False (PathFromEdge edge 0 `S.member`) (rpt ^? offPathEdges) f edge rpt = maybe False (PathFromEdge edge 0 `S.member`) (rpt ^? offPathFromEdges)
roomPillarsPassage :: RandomGen g => State g Room roomPillarsPassage :: RandomGen g => State g Room
roomPillarsPassage = do roomPillarsPassage = do
+2 -2
View File
@@ -42,7 +42,7 @@ randEdgeTank = do
<> horPipe 80 0 (70 *.* cardVec edge)))) <> horPipe 80 0 (70 *.* cardVec edge))))
-- 70 is a guess, the true value depends on the distance to the wall -- 70 is a guess, the true value depends on the distance to the wall
& plSpot .~ rprBool (\rp _ -> _rpPlacementUse rp == 0 & plSpot .~ rprBool (\rp _ -> _rpPlacementUse rp == 0
&& rpOffPathEdge (PathFromEdge edge 0) rp) && rpOffPathFromEdge (PathFromEdge edge 0) rp)
randEdgeTanks :: RandomGen g => Int -> State g [Placement] randEdgeTanks :: RandomGen g => Int -> State g [Placement]
randEdgeTanks i = do randEdgeTanks i = do
@@ -54,7 +54,7 @@ randEdgeTanks i = do
<> horPipe 80 0 (70 *.* cardVec edge)))) <> horPipe 80 0 (70 *.* cardVec edge))))
-- 70 is a guess, the true value depends on the distance to the wall -- 70 is a guess, the true value depends on the distance to the wall
& plSpot .~ rprBool (\rp _ -> _rpPlacementUse rp == 0 & plSpot .~ rprBool (\rp _ -> _rpPlacementUse rp == 0
&& rpOffPathEdge (PathFromEdge edge 0) rp) && rpOffPathFromEdge (PathFromEdge edge 0) rp)
tanksPipesRoom :: RandomGen g => State g Room tanksPipesRoom :: RandomGen g => State g Room
tanksPipesRoom = do tanksPipesRoom = do