Determine thunk leak when marking seen walls

This commit is contained in:
2021-10-29 17:25:12 +01:00
parent 686a9fc3ee
commit 50d0f18ab7
6 changed files with 26 additions and 32 deletions
+4 -10
View File
@@ -4,15 +4,10 @@ module Dodge.LevelGen.Block
)
where
import Dodge.Data
--import Dodge.Data.SoundOrigin
import Dodge.Base
import Dodge.Zone
--import Dodge.SoundLogic
--import Dodge.SoundLogic.LoadSound
--import Dodge.WorldEvent.Sound
import Dodge.LevelGen.Pathing
import Dodge.Default.Wall
--import Dodge.RandomHelp
import Geometry
import qualified IntMapHelp as IM
import Color
@@ -31,7 +26,7 @@ addBlock
addBlock (p:ps) hp col isSeeThrough hps w
| hp <= 0 && null hps = w
| hp <= 0 = addBlock (p:ps) (head hps + hp) col isSeeThrough (tail hps) w
| otherwise = w
| otherwise = w
& wallsZone . znObjects %~ flip (IM.foldl' $ flip wallInZone) panes
& walls %~ IM.union panes
& blocks %~ IM.insert blid (Block {_blID = blid,_blWallIDs = is, _blHPs = hp:hps, _blShadows=[]})
@@ -40,13 +35,13 @@ addBlock (p:ps) hp col isSeeThrough hps w
lns = zip (p:ps) (ps ++ [p])
i = IM.newKey $ _walls w
is = [i.. i + length lns-1]
panes = IM.fromList $ zip is $ zipWith
(\j (a,b) -> defaultWall
panes = IM.fromList $ zipWith
(\j (a,b) -> (,) j defaultWall
{ _wlLine = (a,b)
, _wlID = j
, _wlColor = col
, _wlIsSeeThrough = isSeeThrough
, _wlBlockID = Just blid
, _wlBlockID = Just' blid
}
) is lns
wallInZone wl
@@ -59,7 +54,6 @@ addBlock (p:ps) hp col isSeeThrough hps w
ips = map zoneOfPoint $ uncurry (divideLine (2*zoneSize)) (_wlLine wl)
addBlock _ _ _ _ _ _ = error "Trying to add a block with incomplete polygon"
---- TODO add block list to world
putBlock :: [Point2] -> Int -> Color -> Bool -> [Int] -> World -> (Int,World)
putBlock (p:ps) i c b is w = (0, foldr (uncurry removePathsCrossing) wWithBlock pairs)
where