Update path zoning on reading a save

This commit is contained in:
2025-10-21 15:50:49 +01:00
parent 1918fc8c56
commit fcffbd5f43
4 changed files with 13 additions and 3 deletions
+10 -3
View File
@@ -9,14 +9,15 @@ module Dodge.Save (
reloadLevelStart,
) where
import Dodge.Zoning.Pathing
import qualified Data.Vector.Unboxed as UV
import Control.Monad
import Data.Maybe
import Dodge.WorldLoad
--import Dodge.Path.Translate
--import Data.Graph.Inductive (labEdges, labNodes)
--import Dodge.Zoning.Pathing
--import Data.Foldable
import Data.Foldable
import Dodge.Wall.Zone
import Dodge.Concurrent
import Control.Lens
@@ -47,10 +48,16 @@ readSaveSlot ss = do
fExists <- doesFileExist $ saveSlotPath ss
unless fExists $ error "Tried to read non-existant save file"
mcw <- decodeFileStrict $ saveSlotPath ss
flip (maybe (error "Tried to read incorrectly encoded save file")) mcw $ \cw ->
flip (maybe (error "Tried to read incorrectly encoded save file")) mcw $ \cw -> do
let inodes = cw ^. incNode
return $ \uv -> Just
$ uv & uvWorld . cWorld .~ cw
& uvWorld %~ initWallZoning
& uvWorld . incNodeZoning
.~ UV.ifoldl' (\m i p -> zonePn (i,p) m) mempty inodes
& uvWorld . incEdgeZoning
.~ foldl' (flip (zoneIncPe inodes)) mempty
(cw ^. incEdges)
-- & uvWorld . pnZoning .~ foldl' (flip zonePn) mempty
-- (labNodes $ path uv)
-- & uvWorld . peZoning .~ foldl' (flip zonePe) mempty