Cleanup compiler warnings

This commit is contained in:
2024-10-22 10:48:44 +01:00
parent c0b1092fb6
commit 65f05b93f8
10 changed files with 72 additions and 161 deletions
+14 -14
View File
@@ -1,3 +1,4 @@
{-# OPTIONS -Wno-incomplete-uni-patterns #-}
module Dodge.Debug.Picture where
import Control.Lens
@@ -5,19 +6,21 @@ import Data.Foldable
import qualified Data.Graph.Inductive as FGL
import qualified Data.Map.Strict as M
import Data.Maybe
import qualified Data.Set as S
import Dodge.Base
import Dodge.Creature.Picture.Awareness
import Dodge.Data.Universe
import Dodge.GameRoom
import Dodge.Graph
import Dodge.Path
import Dodge.Picture.SizeInvariant
import Dodge.Render.InfoBox
import Dodge.Render.Label
import Dodge.Render.List
import Dodge.ShortShow
import Dodge.SoundLogic.LoadSound
import Dodge.Viewpoints
import Dodge.WorldEvent.ThingsHit
import Dodge.Zoning
import Dodge.Zoning.Base
import Geometry
@@ -28,9 +31,6 @@ import Picture
import SDL (MouseButton (..))
import ShortShow
import Sound.Data
import qualified Data.Set as S
import Dodge.Render.Label
import Dodge.WorldEvent.ThingsHit
printPoint :: Point2 -> Picture
printPoint p = color white $ uncurryV translate p $ fold [circle 3, scale 0.05 0.05 $ text (show p)]
@@ -107,11 +107,13 @@ drawCollisionTest w = fromMaybe mempty $ do
return $
setLayer DebugLayer (color orange $ line [a, b])
<> foldMap (drawCrossCol red . fst) (thingHit a b w)
-- <> foldMap (drawCross . _crPos) (crsNearSeg a b w)
-- <> foldMap (drawZoneCol green crZoneSize . zoneOfPoint crZoneSize) (xIntercepts crZoneSize a b)
-- <> foldMap (drawZoneCol yellow crZoneSize . zoneOfPoint crZoneSize) (yIntercepts' crZoneSize a b)
-- <> foldMap (drawLabCrossCol blue) (xIntercepts crZoneSize a b)
-- # OPTIONS -Wno-incomplete-uni-patterns #-}
drawZoneCol :: Color -> Float -> V2 Int -> Picture
drawZoneCol col s (V2 x y) = setLayer DebugLayer . color col $ thickLine 2 (p : ps ++ [p])
where
@@ -337,7 +339,6 @@ drawWlIDs w = setLayer FixedCoordLayer $ foldMap f (w ^. cWorld . lWorld . walls
where
p = worldPosToScreen (w ^. wCam) $ 0.5 *.* uncurry (+.+) (_wlLine wl)
drawCrInfo :: Configuration -> World -> Picture
drawCrInfo cfig w =
setLayer FixedCoordLayer $
@@ -345,14 +346,14 @@ drawCrInfo cfig w =
mapMaybe crDisplayInfo $ IM.elems $ w ^. cWorld . lWorld . creatures
where
cam = w ^. wCam
-- drawPathing :: Configuration -> World -> Picture
-- drawPathing cfig w =
-- setLayer DebugLayer $
-- foldMap (edgeToPic (screenPolygon cfig (w ^. wCam)) . (^?! _3)) (FGL.labEdges gr)
-- <> foldMap dispInc (graphToIncidence gr)
-- where
-- dispInc (p, n) = setDepth 2 . uncurryV translate p . scale 0.1 0.1 $ text $ show n
-- gr = w ^. cWorld . pathGraph
-- drawPathing :: Configuration -> World -> Picture
-- drawPathing cfig w =
-- setLayer DebugLayer $
-- foldMap (edgeToPic (screenPolygon cfig (w ^. wCam)) . (^?! _3)) (FGL.labEdges gr)
-- <> foldMap dispInc (graphToIncidence gr)
-- where
-- dispInc (p, n) = setDepth 2 . uncurryV translate p . scale 0.1 0.1 $ text $ show n
-- gr = w ^. cWorld . pathGraph
crDisplayInfo :: Creature -> Maybe (Point2, [String])
crDisplayInfo cr
@@ -396,4 +397,3 @@ edgeToPic poly pe
where
sp = _peStart pe
ep = _peEnd pe
+7 -5
View File
@@ -1,3 +1,4 @@
{-# OPTIONS -Wno-incomplete-uni-patterns #-}
{-# LANGUAGE TupleSections #-}
module Dodge.HeldUse (
@@ -5,8 +6,8 @@ module Dodge.HeldUse (
mcUseHeld,
) where
import Control.Monad
import Color
import Control.Monad
import Data.Maybe
import Dodge.Base.Collide
import Dodge.Base.Coordinate
@@ -162,6 +163,7 @@ makeMuzzleFlare mz itmtree cr = case mz ^. mzFlareType of
pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
dir = _crDir cr + _mzRot mz
--{-# OPTIONS -Wno-incomplete-uni-patterns #-}
muzFlareAt :: Color -> Point3 -> Float -> World -> World
muzFlareAt col tranv dir w =
w & randGen .~ g
@@ -169,10 +171,10 @@ muzFlareAt col tranv dir w =
where
thepic =
setLayer BloomNoZWrite . translate3 tranv . color col . rotate dir . polygon $
[ V2 0 0
, V2 a (- b)
, V2 c d
]
[ V2 0 0
, V2 a (- b)
, V2 c d
]
thestate = replicateM 4 $ state $ randomR (2, 20)
(a : b : c : d : _, g) = runState thestate $ _randGen w -- randomRs (2, 20) (_randGen w)
+9 -7
View File
@@ -1,5 +1,6 @@
module Dodge.Room.RezBox where
import Control.Monad
import qualified Data.Set as S
import Dodge.Cleat
import Dodge.Data.GenWorld
@@ -18,7 +19,6 @@ import Geometry
import LensHelp
import Padding
import RandomHelp
import Control.Monad
rezBox :: LightSource -> Room
rezBox ls =
@@ -51,8 +51,9 @@ rezBoxesWp = do
let aroom = rezInvBox thecol -- & rmConnectsTo .~ S.singleton (OnEdge North)
let isnorth = S.member (OnEdge North) . _rlType
centralRoom <-
shuffleLinks $(roomRectAutoLinks w h){_rmPmnts = []}
& rmLinks %~ setLinkType InLink isnorth
shuffleLinks $
(roomRectAutoLinks w h){_rmPmnts = []}
& rmLinks %~ setLinkType InLink isnorth
onwardpassage <- shootOutPassage
let n = length $ getLinksOfType (OnEdge North) $ _rmLinks centralRoom
let rezrooms =
@@ -117,10 +118,11 @@ rezBoxes = do
shuffleLinks $
(roomRectAutoLinks w h){_rmPmnts = []}
& rmLinks %~ setInLinks bottomEdgeTest
let n = length $ filter bottomEdgeTest $_rmLinks centralRoom
return $
tToBTree "rezBoxes" $treeFromTrunk [rezBox thecol, door] $
Node centralRoom (replicate (n -1) dbox ++ [Node (cleatOnward door) []])
let n = length $ filter bottomEdgeTest $ _rmLinks centralRoom
return
. tToBTree "rezBoxes"
. treeFromTrunk [rezBox thecol, door]
$ Node centralRoom (replicate (n -1) dbox ++ [Node (cleatOnward door) []])
rezColor :: RandomGen g => State g LightSource
rezColor = do
+5 -1
View File
@@ -1,10 +1,14 @@
module Dodge.WdP2f where
{-# OPTIONS -Wno-incomplete-uni-patterns #-}
module Dodge.WdP2f
( doWdP2f
) where
import Control.Lens
import Dodge.Data.World
import Geometry.Data
import Geometry.Vector
-- # OPTIONS -Wno-incomplete-uni-patterns #-}
doWdP2f :: WdP2f -> World -> (Point2, Float)
doWdP2f x = case x of
WdP2f0 -> const (0, 0)