From 87f1444f5c77a45cb347064cc21a8e88883fdbd1 Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 23 Sep 2025 21:02:27 +0100 Subject: [PATCH] Cleanup --- src/Dodge/Data/GenWorld.hs | 4 ++-- src/Dodge/LevelGen/LevelStructure.hs | 1 + src/Dodge/Placement/Instance/Terminal.hs | 4 ++-- src/Dodge/Placement/PlaceSpot.hs | 2 +- src/Dodge/Room/LongDoor.hs | 2 +- src/Dodge/Tree/Compose.hs | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Dodge/Data/GenWorld.hs b/src/Dodge/Data/GenWorld.hs index 76e79cba5..d8774696f 100644 --- a/src/Dodge/Data/GenWorld.hs +++ b/src/Dodge/Data/GenWorld.hs @@ -24,6 +24,7 @@ data GenWorld = GenWorld { _gwWorld :: World , _genRooms :: IM.IntMap Room , _genPmnt :: IM.IntMap Placement + , _genInts :: IM.IntMap Int } ---- ROOM DATATYPES @@ -56,7 +57,7 @@ data PSType | PutDoor Color EdgeObstacle WdBl [(Point2, Point2)] | RandPS (State StdGen PSType) | PutForeground ForegroundShape - | PutWorldUpdate (PlacementSpot -> GenWorld -> GenWorld) + | PutWorldUpdate (Room -> PlacementSpot -> GenWorld -> GenWorld) | PutNothing | PutID {_putID :: Int} | PutChasm {_putChasmPoly :: [Point2]} @@ -107,7 +108,6 @@ data Room = Room , _rmPath :: S.Set (Point2, Point2) , _rmPmnts :: [Placement] , _rmInPmnt :: [GenWorld -> Placement] --- , _rmOutPmnt :: IM.IntMap Placement , _rmBound :: [[Point2]] , _rmFloor :: Floor , _rmName :: String diff --git a/src/Dodge/LevelGen/LevelStructure.hs b/src/Dodge/LevelGen/LevelStructure.hs index 430565c20..2653db911 100644 --- a/src/Dodge/LevelGen/LevelStructure.hs +++ b/src/Dodge/LevelGen/LevelStructure.hs @@ -17,6 +17,7 @@ worldToGenWorld rms w = { _gwWorld = w & cWorld . cwGen . cwgParams .~ evalState generateGenParams (_randGen w) , _genRooms = rms , _genPmnt = mempty + , _genInts = mempty } generateGenParams :: RandomGen g => State g GenParams diff --git a/src/Dodge/Placement/Instance/Terminal.hs b/src/Dodge/Placement/Instance/Terminal.hs index a339536e7..beebadd5c 100644 --- a/src/Dodge/Placement/Instance/Terminal.hs +++ b/src/Dodge/Placement/Instance/Terminal.hs @@ -17,7 +17,7 @@ import LensHelp putTerminalImediateAccess :: Color -> Machine -> Terminal -> Placement putTerminalImediateAccess = putTerminalFull f where - f tmpl _ _ = Just $ sps0 $ PutWorldUpdate $ const $ over gwWorld $ accessTerminal (tmpl ^?! plMID . _Just) + f tmpl _ _ = Just $ sps0 $ PutWorldUpdate $ const $ const $ over gwWorld $ accessTerminal (tmpl ^?! plMID . _Just) putTerminalFull :: (Placement -> Placement -> Placement -> Maybe Placement) -> @@ -39,7 +39,7 @@ putTerminalFull f col mc tm = defaultSensorWall Nothing ) - $ \mcpl -> Just $ pt0 (PutWorldUpdate $ const $ over gwWorld (setids tmpl btpl mcpl)) (\_ -> f tmpl btpl mcpl) + $ \mcpl -> Just $ pt0 (PutWorldUpdate $ const $ const $ over gwWorld (setids tmpl btpl mcpl)) (\_ -> f tmpl btpl mcpl) where setids tmpl btpl mcpl w = w diff --git a/src/Dodge/Placement/PlaceSpot.hs b/src/Dodge/Placement/PlaceSpot.hs index 88b22f7b7..78829948f 100644 --- a/src/Dodge/Placement/PlaceSpot.hs +++ b/src/Dodge/Placement/PlaceSpot.hs @@ -122,7 +122,7 @@ placeSpotID rm ps pt w = case pt of PutWall qs wl -> (0, over gwWorld (placeWallPoly (map doShift qs) wl) w) PutNothing -> (0, w) PutID i -> (i, w) - PutWorldUpdate f -> (0, w & f ps) + PutWorldUpdate f -> (0, w & f rm ps) PutChasm ps' -> (0, w & gwWorld . cWorld . chasms .:~ map doShift ps') where p@(V2 px py) = _psPos ps diff --git a/src/Dodge/Room/LongDoor.hs b/src/Dodge/Room/LongDoor.hs index d335724e8..ab3d520cd 100644 --- a/src/Dodge/Room/LongDoor.hs +++ b/src/Dodge/Room/LongDoor.hs @@ -120,7 +120,7 @@ addButtonSlowDoor x h rm = do (aShape (V2 15 0) (V3 15 xoff 90)) $ \plls plpr -> Just $ - ptCont (PutWorldUpdate (const $ over gwWorld $ setmount dr plls plpr)) $ + ptCont (PutWorldUpdate (const $ const $ over gwWorld $ setmount dr plls plpr)) $ const mpl setmount pldr plls plpr = cWorld . lWorld . doors . ix (fromJust $ _plMID pldr) . drMounts diff --git a/src/Dodge/Tree/Compose.hs b/src/Dodge/Tree/Compose.hs index 0d8d690b4..3900baae7 100644 --- a/src/Dodge/Tree/Compose.hs +++ b/src/Dodge/Tree/Compose.hs @@ -100,7 +100,7 @@ attachOnward' t1 t2 = MTree (_mtLabel t1) (NodeMTree t1) [MBranch toOnward t2] toOnward :: Room -> Maybe Room toOnward rm - | OnwardCluster `elem` rm ^?! rmClusterStatus . csLinks = + | OnwardCluster `elem` rm ^. rmClusterStatus . csLinks = Just (rm & rmClusterStatus . csLinks . at OnwardCluster .~ Nothing) | otherwise = Nothing