From 51c52ace7dc97433fe41515fe768d84f8aeee56c Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 21 Dec 2025 19:27:49 +0000 Subject: [PATCH] More hlinting --- src/Dodge/Machine/Update.hs | 4 ++-- src/Dodge/Material/Damage.hs | 4 ++-- src/Dodge/Placement/Instance/Button.hs | 15 +++++---------- src/Dodge/Placement/PlaceSpot.hs | 3 +-- src/Dodge/Placement/PlaceSpot/Block.hs | 4 ++-- src/Dodge/Render/InfoBox.hs | 5 +++-- src/Dodge/Render/ShapePicture.hs | 2 +- src/Dodge/Room/Boss.hs | 3 +-- src/Dodge/Room/Corridor.hs | 22 +++++++++++----------- src/Dodge/Room/Door.hs | 6 +++--- src/Dodge/Room/LongDoor.hs | 2 +- src/Dodge/Room/RezBox.hs | 2 +- src/Dodge/Room/Room.hs | 2 +- src/Dodge/Room/Treasure.hs | 2 +- src/Dodge/Room/Tutorial.hs | 2 +- src/Dodge/Update/Input/InGame.hs | 4 ++-- src/Dodge/WorldEvent/Explosion.hs | 2 +- src/Polyhedra/Geodesic.hs | 3 ++- 18 files changed, 41 insertions(+), 46 deletions(-) diff --git a/src/Dodge/Machine/Update.hs b/src/Dodge/Machine/Update.hs index 07e6ff657..114c59995 100644 --- a/src/Dodge/Machine/Update.hs +++ b/src/Dodge/Machine/Update.hs @@ -207,8 +207,8 @@ mcProxTest w = \case RequireHealth x -> fromMaybe 0 (cr ^? crHP . _HP) >= x RequireEquipment ct -> any - (\itm -> _itType itm == ct) - ((\k -> w ^?! cWorld . lWorld . items . ix k) <$> _crInv cr) + ((\itm -> _itType itm == ct) + . (\k -> w ^?! cWorld . lWorld . items . ix k)) (_crInv cr) RequireDeadCreatures is -> all (\x -> null (x ^? crHP . _HP)) (IM.restrictKeys (w ^. cWorld . lWorld . creatures) (IS.fromList is)) where diff --git a/src/Dodge/Material/Damage.hs b/src/Dodge/Material/Damage.hs index 3e8582996..df035a164 100644 --- a/src/Dodge/Material/Damage.hs +++ b/src/Dodge/Material/Damage.hs @@ -153,7 +153,7 @@ damageDirt dm _ w = damageGlass :: Damage -> ECW -> World -> (Int,World) damageGlass dm ecw w = case dm of - Lasering {} -> f 0 $ id + Lasering {} -> f 0 id Piercing _ p t -> f dmam $ makeSpark NormalSpark (outTo p t) (rdir p t) -- . makeDustAt Stone 200 (addZ 20 (outTo p t)) @@ -219,7 +219,7 @@ damageGlass dm ecw w = case dm of damageCrystal :: Damage -> ECW -> World -> (Int,World) damageCrystal dm ecw w = case dm of - Lasering {} -> f $ id + Lasering {} -> f id Piercing _ p t -> f $ makeSpark NormalSpark (outTo p t) (rdir p t) . randsound p [marimbaC5S,marimbaE5S,marimbaG5S,marimbaB6S] diff --git a/src/Dodge/Placement/Instance/Button.hs b/src/Dodge/Placement/Instance/Button.hs index 4ff12d843..3de4e5dc3 100644 --- a/src/Dodge/Placement/Instance/Button.hs +++ b/src/Dodge/Placement/Instance/Button.hs @@ -62,11 +62,7 @@ triggerSwitch col ps = psPtCont ps (PutTrigger False) $ where trigid tp = fromJust $ _plMID tp -putLitButOnPos :: - Color -> - PlacementSpot -> - (Placement -> Maybe Placement) -> - Placement +putLitButOnPos :: Color -> PlacementSpot -> (Placement -> Maybe Placement) -> Placement putLitButOnPos col theps subpl = plSpot .~ theps $ mntLSOn aShape (Just col) ls 0 (V3 0 (-40) 40) $ @@ -77,20 +73,19 @@ putLitButOnPos col theps subpl = <&> plSpot .~ _plSpot plmnt where - changeLight lsid = SetLSCol (V3 0 0.5 0) lsid + changeLight = SetLSCol (V3 0 0.5 0) ls = lsColPosRad (V3 0.5 0 0) (V3 0 0 50) 50 -- creates a lit external trigger, passes the trigger placement forward extTrigLitPos :: PlacementSpot -> (Placement -> Maybe Placement) -> Placement extTrigLitPos ps f = psPtCont ps (PutTrigger False) $ \tp -> Just $ - pContID (ps' tp) (PutLS thels) $ + pContID (_plSpot tp) (PutLS thels) $ \lsid -> Just $ - pContID (ps' tp) (PutMod $ themod lsid tp) $ + pContID (_plSpot tp) (PutMod $ themod lsid tp) $ const (f tp) where - ps' tp = _plSpot tp themod lsid tp = ModIDID { _mdID = 0 @@ -126,6 +121,6 @@ putLitButOnPosExtTrig' col thePS cnt = .~ _plSpot plmnt where trigid tp = fromJust $ _plMID tp - oneff tid = SetTrigger True tid + oneff = SetTrigger True changeLight = SetLSCol (V3 0 0.5 0) ls = lsColPosRad (V3 0.5 0 0) (V3 0 0 50) 50 diff --git a/src/Dodge/Placement/PlaceSpot.hs b/src/Dodge/Placement/PlaceSpot.hs index 3e5e45f81..48d6d8030 100644 --- a/src/Dodge/Placement/PlaceSpot.hs +++ b/src/Dodge/Placement/PlaceSpot.hs @@ -57,11 +57,10 @@ placePlainPSSpot w rid plmnt shift = case plmnt ^. plType of f x gw = fromMaybe gw $ do j <- x ^. plExternalID return $ gw & genPmnt . at j ?~ x - recrPlace newplmnt w' pl = + recrPlace newplmnt w' = placeSpot rid (w' & genRooms . ix rid . rmPmnts .:~ newplmnt) - pl -- this should be tidied up placeSpotUsingLink :: diff --git a/src/Dodge/Placement/PlaceSpot/Block.hs b/src/Dodge/Placement/PlaceSpot/Block.hs index a83ff4eeb..12166cec3 100644 --- a/src/Dodge/Placement/PlaceSpot/Block.hs +++ b/src/Dodge/Placement/PlaceSpot/Block.hs @@ -87,8 +87,8 @@ plLineBlock basePane blwidth a b gw = $ upperBox Medium Typical 3 [a + x + n - midp, a + x - (n + midp), b - (n + x + midp), b + n - (x + midp)] ) - midp = (0.5 * (a + b)) - x = (blwidth + 1) *^ (normalize $ a - b) + midp = 0.5 * (a + b) + x = (blwidth + 1) *^ normalize (a - b) n = vNormal x insertBlock (i, p) = insertWalls (makeWallAt p i) diff --git a/src/Dodge/Render/InfoBox.hs b/src/Dodge/Render/InfoBox.hs index 0f2b2db22..9c03d0d77 100644 --- a/src/Dodge/Render/InfoBox.hs +++ b/src/Dodge/Render/InfoBox.hs @@ -1,9 +1,9 @@ +{-# LANGUAGE TupleSections #-} module Dodge.Render.InfoBox ( renderInfoListAt, renderInfoListsAt, ) where --- this should be imported implicitly import Dodge.Base import Dodge.Data.Camera import Dodge.Data.CardinalPoint @@ -13,6 +13,7 @@ import Dodge.Render.Connectors import Dodge.Render.List import Geometry import Picture +import Control.Lens renderInfoListAt :: Float -> @@ -22,7 +23,7 @@ renderInfoListAt :: (Point2, [String]) -> Picture renderInfoListAt x y cfig cam (p, ss) = - toTopLeft cfig (renderListAt x y (zip ss (repeat white))) + toTopLeft cfig (renderListAt x y (ss <&> (,white))) <> color white (lConnect (V2 (x - hw) (hh -25 - y)) (worldPosToScreen cam p)) <> toTopLeft cfig diff --git a/src/Dodge/Render/ShapePicture.hs b/src/Dodge/Render/ShapePicture.hs index 77f7b8625..d50d85de2 100644 --- a/src/Dodge/Render/ShapePicture.hs +++ b/src/Dodge/Render/ShapePicture.hs @@ -49,7 +49,7 @@ worldSPic cfig u = pointIsClose = cullPoint cfig w drawBlock :: Block -> SPic -drawBlock = (noPic . _blDraw) +drawBlock = noPic . _blDraw drawChasm :: [Point2] -> SPic drawChasm = foldMap (Prelude.uncurry drawCliff) . loopPairs diff --git a/src/Dodge/Room/Boss.hs b/src/Dodge/Room/Boss.hs index 3e61dd86d..aef61179d 100644 --- a/src/Dodge/Room/Boss.hs +++ b/src/Dodge/Room/Boss.hs @@ -99,8 +99,7 @@ roomCross x y = , (V2 (- x) (20 - y), pi / 2) , (V2 (20 - y) (- x), pi) ] - ++ [ uncurry inLink (V2 (y -20) (- x), pi) - ] + ++ [ inLink (V2 (y -20) (- x)) pi ] , _rmPath = mempty , _rmPmnts = [ spanLightI (V2 (x + 5) x) (V2 (x + 5) (- x)) diff --git a/src/Dodge/Room/Corridor.hs b/src/Dodge/Room/Corridor.hs index c41e40d2c..f06e679b7 100644 --- a/src/Dodge/Room/Corridor.hs +++ b/src/Dodge/Room/Corridor.hs @@ -31,10 +31,10 @@ corridor = where poly = rectNSWE 80 0 0 40 lnks' = - [ uncurry outLink (V2 20 70, 0) - , uncurry outLink (V2 20 70, pi / 6) - , uncurry outLink (V2 20 70, negate $ pi / 6) - , uncurry inLink (V2 20 10, pi) + [ outLink (V2 20 70) 0 + , outLink (V2 20 70) (pi / 6) + , outLink (V2 20 70) (negate $ pi / 6) + , inLink (V2 20 10) pi ] keyholeCorridor :: Room @@ -64,8 +64,8 @@ corridorN = } where lnks = - [ uncurry outLink (V2 20 70, 0) - , uncurry inLink (V2 20 10, pi) + [ outLink (V2 20 70) 0 + , inLink (V2 20 10) pi ] pth = doublePairSet (V2 20 70, V2 20 10) @@ -82,8 +82,8 @@ corridorWallN = } where lnks = - [ uncurry outLink (V2 20 70, 0) - , uncurry inLink (V2 20 10, pi) + [ outLink (V2 20 70) 0 + , inLink (V2 20 10) pi ] pth = doublePairSet (V2 20 70, V2 20 10) @@ -108,9 +108,9 @@ tEast = , (V2 0 10, pi) ] lnks' = - [ uncurry outLink (V2 30 60, - pi / 2) - , uncurry outLink (V2 (-30) 60, pi / 2) - , uncurry inLink (V2 0 10, pi) + [ outLink (V2 30 60) (- pi / 2) + , outLink (V2 (-30) 60) (pi / 2) + , inLink (V2 0 10) pi ] tWest :: Room diff --git a/src/Dodge/Room/Door.hs b/src/Dodge/Room/Door.hs index 0e3c19929..5c92a6f54 100644 --- a/src/Dodge/Room/Door.hs +++ b/src/Dodge/Room/Door.hs @@ -23,15 +23,15 @@ door = } where lnks = - [ uncurry outLink (V2 20 35, 0) - , uncurry inLink (V2 20 5, pi) + [ outLink (V2 20 35) 0 + , inLink (V2 20 5) pi ] triggerDoorRoom :: Int -> Room triggerDoorRoom i = defaultRoom { _rmPolys = [rectNSWE 40 0 0 40] - , _rmLinks = [uncurry outLink (V2 20 35, 0), uncurry inLink (V2 20 5, pi)] + , _rmLinks = [outLink (V2 20 35) 0, inLink (V2 20 5) pi] , _rmPath = doublePairSet (V2 20 35, V2 20 5) , _rmInPmnt = [(0,f)] , _rmName = "triggerDoorRoom" diff --git a/src/Dodge/Room/LongDoor.hs b/src/Dodge/Room/LongDoor.hs index 40a5ff146..9ed559cb3 100644 --- a/src/Dodge/Room/LongDoor.hs +++ b/src/Dodge/Room/LongDoor.hs @@ -48,7 +48,7 @@ twinSlowDoorRoom w h x = [ (V2 w (h / 2), negate $ pi / 2) , (V2 (- w) (h / 2), pi / 2) ] - ++ [uncurry inLink (V2 0 (- h), pi)] + ++ [inLink (V2 0 (- h)) pi] , _rmPath = mempty , _rmPmnts = [ pContID (PS (V2 0 (h -5)) pi) (PutButton $ makeButton col NoWorldEffect) $ diff --git a/src/Dodge/Room/RezBox.hs b/src/Dodge/Room/RezBox.hs index bb96a3ebb..e6c26115b 100644 --- a/src/Dodge/Room/RezBox.hs +++ b/src/Dodge/Room/RezBox.hs @@ -111,7 +111,7 @@ rezBoxesWpCrit = do treeFromTrunk [rezBox thecol, door] $ Node centralRoom (rezrooms ++ [onwardpassage]) where - adddoor rm = treeFromPost [door & rmConnectsTo .~ S.member (OnEdge North)] rm + adddoor = treeFromPost [door & rmConnectsTo .~ S.member (OnEdge North)] crAdd :: Room -> Room crAdd = rmPmnts .:~ sPS (V2 20 10) (0.5 * pi) randC1 diff --git a/src/Dodge/Room/Room.hs b/src/Dodge/Room/Room.hs index d710fe006..114d02e42 100644 --- a/src/Dodge/Room/Room.hs +++ b/src/Dodge/Room/Room.hs @@ -429,7 +429,7 @@ distributerRoom atype aamount = do (PutMachine (reverse $ polyCirc 4 20) mcstore Nothing) & plExternalID ?~ i dst gw = let mj = gw ^? genPmnt . ix i . plMID . _Just in putTerminal (mcdist mj) (defaultTerminal & tmBootLines .~ tmDistributeLines) - & plSpot .~ (unusedOffPathAwayFromLink 50) + & plSpot .~ unusedOffPathAwayFromLink 50 & plExternalID ?~ i1 thepipe gw = let p1 = gw ^?! genPmnt . ix i . plSpot . psPos diff --git a/src/Dodge/Room/Treasure.hs b/src/Dodge/Room/Treasure.hs index fc7a7f561..a81879629 100644 --- a/src/Dodge/Room/Treasure.hs +++ b/src/Dodge/Room/Treasure.hs @@ -30,7 +30,7 @@ triLootRoom w h = [ tri , base ] - , _rmLinks = [uncurry inLink (V2 0 (-80), pi)] + , _rmLinks = [inLink (V2 0 (-80)) pi] , _rmPath = doublePairSet (V2 0 (-80), V2 0 (h / 2)) , _rmPmnts = [ sPS (V2 (15 - w) 15) 0 $ PutID 0 diff --git a/src/Dodge/Room/Tutorial.hs b/src/Dodge/Room/Tutorial.hs index af37ed332..fbfa898bd 100644 --- a/src/Dodge/Room/Tutorial.hs +++ b/src/Dodge/Room/Tutorial.hs @@ -103,7 +103,7 @@ tutDrop = do treePost [x & rmInPmnt .:~ (0, t j), y, cleatOnward rm] where - t j = \gw -> + t j gw = let x = gw ^? genInts . ix j in putMessageTerminal (defaultTerminal & tmBootLines .~ ss <> tlSetStatus (TerminalPressTo $ show x <> "QUIT") <> tlDoEffect TmWdWdPowerDownTerminal) diff --git a/src/Dodge/Update/Input/InGame.hs b/src/Dodge/Update/Input/InGame.hs index 4d87944e2..992790fa0 100644 --- a/src/Dodge/Update/Input/InGame.hs +++ b/src/Dodge/Update/Input/InGame.hs @@ -187,7 +187,7 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of _ -> w where getuniques x y = IS.union x y IS.\\ IS.intersection x y - f (x, y) z = Sel x y z + f (x, y) = Sel x y h (k, i) j = fold $ do sss <- w ^? hud . diSections . ix k . ssItems let (_, xss) = IM.split (min i j -1) sss @@ -353,7 +353,7 @@ shiftInvItemsDown j is w = fromMaybe w $ do guard . isJust $ w ^? hud . diSections . ix j . ssItems . ix i return $ IS.foldr f w is where - f i' w' = swapItemWith g (j, i') w' + f i' = swapItemWith g (j, i') g i' m = fst <$> IM.lookupGT i' m updateFunctionKeys :: Universe -> Universe diff --git a/src/Dodge/WorldEvent/Explosion.hs b/src/Dodge/WorldEvent/Explosion.hs index cdde18472..754290a72 100644 --- a/src/Dodge/WorldEvent/Explosion.hs +++ b/src/Dodge/WorldEvent/Explosion.hs @@ -77,6 +77,6 @@ makeExplosionAt p vel w = fdamps = replicateM 100 (state $ randomR (0, 1)) & evalState $ _randGen w sizes = randomRs (2, 9) $ _randGen w times = randomRs (15, 20) $ _randGen w - mF v damp size time = makeFlamelet p (v + damp *^ vel) size time + mF v damp = makeFlamelet p (v + damp *^ vel) newFs = zipWith4 mF fVs fdamps sizes times addFlames w' = foldl' (&) w' newFs diff --git a/src/Polyhedra/Geodesic.hs b/src/Polyhedra/Geodesic.hs index 7ce195e47..1a81e1fdd 100644 --- a/src/Polyhedra/Geodesic.hs +++ b/src/Polyhedra/Geodesic.hs @@ -30,7 +30,8 @@ icosohedronFaces = map orderFace $ negThd (x,y,z) = (x,y,negate z) rotTrip (x,y,z) = (z,x,y) gr = (1 + sqrt 5) / 2 :: Float - orderFace ps = undefined orderAround3 ps + --orderFace ps = undefined orderAround3 ps + orderFace = undefined orderAround3 -- | Assuming that this works, note that it relies heavily on the ordering of -- faces adjacent to a vertex (clockwise around the vertex)