Locate bug in wall zoning

This commit is contained in:
2021-09-11 00:47:52 +01:00
parent c695767fb0
commit 7c62ef4d48
5 changed files with 84 additions and 55 deletions
+26 -1
View File
@@ -2,7 +2,7 @@ module Dodge.Initialisation where
import Dodge.Default.World
import Dodge.Data
import Dodge.Creature
--import Dodge.Base
import Dodge.Base.Zone
import Dodge.Floor
import Dodge.Layout
import Dodge.Story
@@ -11,6 +11,7 @@ import Dodge.SoundLogic
import Dodge.SoundLogic.Synonyms
--import Dodge.Creature.Perception
import Geometry.Data
--import Picture
--import Dodge.GameRoom
--import Geometry
@@ -18,6 +19,9 @@ import System.Random
import qualified Data.Set as S
import qualified Data.IntMap.Strict as IM
import qualified Data.Map as M
import Data.Maybe
import Control.Lens
import Data.List (partition)
--import Data.List (sortOn)
firstWorld :: IO World
@@ -52,8 +56,29 @@ initialWorld = defaultWorld
, _menuLayers = [TerminalScreen 300 rezText']
, _worldState = M.empty
}
-- TODO delete this duplicate
wallsAndWindows
:: World
-> ( [((Point2,Point2),Point4)] ,[((Point2,Point2),Point4)] )
wallsAndWindows w
= (map f wls, map f $ filter (fromMaybe True . (^? blVisible)) wins)
where
f wl = (_wlLine wl, _wlColor wl)
(wins,wls) = partition _wlIsSeeThrough . IM.elems $ wallsDoubleScreen w
testStringInit :: World -> [String]
testStringInit _ = []
--testStringInit = mapMaybe f . IM.elems . wallsDoubleScreen
-- where
-- f (dr@Door{}) = Just . show $ _wlLine dr
-- f _ = Nothing
--testStringInit = map show . filter ((== col) . snd) . fst . wallsAndWindows
-- where
-- col = dim $ dim $ bright red
--testStringInit = mapMaybe f . IM.elems . flattenIMIMIM . _wallsZone
-- where
-- f (dr@Door{}) = Just . show $ _wlLine dr
-- f _ = Nothing
--testStringInit _ = []
--testStringInit w = [show . length $ newSounds w]
--testStringInit w = (show . _crPos $ _creatures w IM.! 0)
-- : (map show . _grBound . last $ sortOn _grName grs)