diff --git a/src/MainGame/WorldMap.hs b/src/MainGame/WorldMap.hs index 3cf99b1..88f8ac4 100644 --- a/src/MainGame/WorldMap.hs +++ b/src/MainGame/WorldMap.hs @@ -86,7 +86,7 @@ loadMapFork ud ad future progress = do fc = FloorConfig (V2 10 10) [(V2 5 5), (V2 5 20)] - (50, 40) + (75, 50) modifyMVar_ progress (return . (\(p, _) -> ( p + increment , "Building floor" @@ -96,8 +96,8 @@ loadMapFork ud ad future progress = do ( p + increment , "Converting to images" ))) - let imgmat = convertTileToImg mat - exits = Prelude.foldl + let !imgmat = convertTileToImg mat + !exits = Prelude.foldl (\acc coord@(r, c) -> if imgmat M.! coord == Just ImgEmpty then ReachPoint RoomExit (V2 r c) NE : acc else acc @@ -109,7 +109,7 @@ loadMapFork ud ad future progress = do , "Placing furniture" ))) (inter, rawrps) <- placeInteriorIO mat imgmat exits gr - let rps = ReachPoint Elevator (fcElevator fc) SE : rawrps + let !rps = ReachPoint Elevator (fcElevator fc) SE : rawrps modifyMVar_ progress (return . (\(p, _) -> ( p + increment , "Creating WorldState" @@ -119,7 +119,7 @@ loadMapFork ud ad future progress = do ( p + increment , "Registering copiers into WorldState" ))) - let copiers = Prelude.filter (\a -> pointType a == Copier) rps + let !copiers = Prelude.filter (\a -> pointType a == Copier) rps mapM_ (\(ReachPoint _ icoord _) -> do let reachCoord = fmap ((+ 0.5) . fromIntegral) icoord void $ createEntity $ newEntity @@ -135,7 +135,7 @@ loadMapFork ud ad future progress = do ( p + increment , "Registering computers into WorldState" ))) - let computers = Prelude.filter (\a -> pointType a == Computer) rps + let !computers = Prelude.filter (\a -> pointType a == Computer) rps mapM_ (\(ReachPoint _ icoord dir) -> do let reachCoord = fmap ((+ 0.5) . fromIntegral) icoord void $ createEntity $ newEntity @@ -152,7 +152,7 @@ loadMapFork ud ad future progress = do ( p + increment , "Registering toilets into WorldState" ))) - let toilets = Prelude.filter (\a -> pointType a == Toilet) rps + let !toilets = Prelude.filter (\a -> pointType a == Toilet) rps mapM_ (\(ReachPoint _ icoord dir) -> do let reachCoord = fmap ((+ 0.5) . fromIntegral) icoord void $ createEntity $ newEntity @@ -174,11 +174,11 @@ loadMapFork ud ad future progress = do , "Unfolding and Converting MindMap to images" ))) let !mmimgmat = convertTileToImg $ manhattan mmgraph mmintmat - pmmpos = (+ 0.5) . (fromIntegral :: Int -> Double) . floor <$> mmPos + !pmmpos = (+ 0.5) . (fromIntegral :: Int -> Double) . floor <$> mmPos (fromJust $ find (\a -> mmId a == 0) (vertexList mmgraph)) - delta = (0, 0) : + !delta = (0, 0) : Prelude.filter (/= (0,0)) ((,) <$> [-1 .. 1] <*> [-1 .. 1]) :: [(Int, Int)] - mmmpos = Prelude.foldl (\acc (dr, dc) -> + !mmmpos = Prelude.foldl (\acc (dr, dc) -> let (V2 pmr pmc) = floor <$> pmmpos seekpos = (pmr + fromIntegral dr, pmc + fromIntegral dc) in if isNothing (mmimgmat M.! seekpos) && mmintmat M.! seekpos == 0 @@ -228,7 +228,7 @@ loadMapFork ud ad future progress = do ))) return mmimgmat )) ad - let retMat = M.fromList (nrows inter) (ncols inter) $ + let !retMat = M.fromList (nrows inter) (ncols inter) $ Prelude.map (\a -> if a == Just ImgEmpty || a == Just ImgEmptyNoWalk then Nothing