Continue to refactor zoning to be more stream-based
This commit is contained in:
@@ -10,6 +10,7 @@ import ShapePicture
|
||||
import Control.Lens
|
||||
--import Data.Maybe
|
||||
import qualified Control.Foldl as L
|
||||
import qualified Streaming.Prelude as S
|
||||
--import Data.List
|
||||
--import qualified Data.IntMap.Strict as IM
|
||||
wallsToDrawStreams
|
||||
@@ -20,11 +21,14 @@ wallsToDrawStreams cfig w
|
||||
= ( wls, wins,spic)
|
||||
where
|
||||
f wl = (_wlLine wl, _wlColor wl)
|
||||
(wls, wins, spic) = L.fold ((,,)
|
||||
(wls, wins, spic) = runIdentity $ L.purely S.fold_
|
||||
((,,)
|
||||
<$> L.prefilter wlOpaqueDraw (L.premap f L.list)
|
||||
<*> L.prefilter wlSeeThroughDraw (L.premap f L.list)
|
||||
<*> L.premap getWallSPic L.mconcat
|
||||
) (wallsDoubleScreen cfig w)
|
||||
) (S.concat $ S.mapMaybe g $ zoneOfSight wallZoneSize w)
|
||||
g (V2 i j) = w ^? wallsZone . znObjects . ix i . ix j
|
||||
|
||||
wlOpaqueDraw :: Wall -> Bool
|
||||
wlOpaqueDraw wl = wlIsOpaque wl && _wlDraw wl
|
||||
wlSeeThroughDraw :: Wall -> Bool
|
||||
|
||||
Reference in New Issue
Block a user