Update path zoning on reading a save
This commit is contained in:
@@ -28,6 +28,7 @@ data CWorld = CWorld
|
||||
-- , _pathGraph :: Gr Point2 PathEdge
|
||||
, _incGraph :: V.Vector [(Int,SimpleEdge)]
|
||||
, _incNode :: UV.Vector Point2
|
||||
, _incEdges :: [(Int,Int)]
|
||||
, _numberFloorVerxs :: Int
|
||||
, _chasms :: [[Point2]]
|
||||
, _numberChasmVerxs :: Int
|
||||
|
||||
@@ -94,6 +94,7 @@ defaultCWorld =
|
||||
, _numberChasmVerxs = 0
|
||||
, _incGraph = mempty
|
||||
, _incNode = mempty
|
||||
, _incEdges = mempty
|
||||
}
|
||||
|
||||
defaultLWorld :: LWorld
|
||||
|
||||
@@ -48,6 +48,7 @@ generateLevelFromRoomList gr' w =
|
||||
-- & cWorld . pathGraph .~ path
|
||||
& cWorld . incNode .~ inodes
|
||||
& cWorld . incGraph .~ igraph
|
||||
& cWorld . incEdges .~ ipairs
|
||||
-- & pnZoning .~ foldl' (flip zonePn) mempty (labNodes path)
|
||||
-- & peZoning .~ foldl' (flip zonePe) mempty (map fromEdgeTuple $ labEdges path)
|
||||
& incNodeZoning .~ UV.ifoldl' (\m i p -> zonePn (i,p) m) mempty inodes
|
||||
|
||||
+10
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user