Make CWorld a member of Store
This commit is contained in:
@@ -221,6 +221,6 @@ makeLenses ''WorldBeams
|
||||
makeLenses ''CWCam
|
||||
makeLenses ''CWGen
|
||||
makeLenses ''CWTime
|
||||
-- $($(derive [d|
|
||||
-- instance Deriving (Store CWorld)
|
||||
-- |]))
|
||||
$($(derive [d|
|
||||
instance Deriving (Store CWorld)
|
||||
|]))
|
||||
|
||||
+45
-22
@@ -1,50 +1,73 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
{- |
|
||||
WARNING: orphan instances concerning Aeson classes and FGL datatypes have been introduced.
|
||||
The warnings have been disabled.
|
||||
-}
|
||||
module Dodge.Data.PathGraph where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Geometry.Data
|
||||
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Graph.Inductive
|
||||
import qualified Data.Set as Set
|
||||
import Data.Map.Strict (Map)
|
||||
import qualified Data.Set as Set
|
||||
import Data.Store
|
||||
import GHC.Generics
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
|
||||
data PathGraph = PathGraph
|
||||
{ _pgGraph :: Gr Point2 PathEdge
|
||||
, _pgNodeMap :: Map Point2 Int
|
||||
, _pgNodeCount :: Int
|
||||
, _pgEdgeMap :: Map (V2 Point2) (Int,Int,PathEdge)
|
||||
{ _pgGraph :: Gr Point2 PathEdge
|
||||
, _pgNodeMap :: Map Point2 Int
|
||||
, _pgNodeCount :: Int
|
||||
, _pgEdgeMap :: Map (V2 Point2) (Int, Int, PathEdge)
|
||||
}
|
||||
deriving (Eq,Show,Read,Generic)
|
||||
instance ToJSON PathGraph where
|
||||
deriving (Eq, Show, Read, Generic)
|
||||
|
||||
instance ToJSON PathGraph where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON PathGraph
|
||||
|
||||
instance FromJSON PathGraph
|
||||
|
||||
data PathEdge = PathEdge
|
||||
{_peStart :: Point2
|
||||
,_peEnd :: Point2
|
||||
,_peDist :: Float
|
||||
,_peObstacles :: Set.Set EdgeObstacle
|
||||
{ _peStart :: Point2
|
||||
, _peEnd :: Point2
|
||||
, _peDist :: Float
|
||||
, _peObstacles :: Set.Set EdgeObstacle
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON PathEdge where
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
|
||||
instance ToJSON PathEdge where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON PathEdge
|
||||
|
||||
instance FromJSON PathEdge
|
||||
|
||||
data EdgeObstacle
|
||||
= BlockObstacle
|
||||
| DoorObstacle
|
||||
| AutoDoorObstacle
|
||||
| WallObstacle
|
||||
deriving (Eq,Ord,Show,Read,Bounded,Enum,Generic)
|
||||
deriving (Eq, Ord, Show, Read, Bounded, Enum, Generic)
|
||||
|
||||
instance ToJSON EdgeObstacle where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON EdgeObstacle
|
||||
instance (ToJSON a,ToJSON b) => ToJSON (Gr a b) where
|
||||
|
||||
instance (ToJSON a, ToJSON b) => ToJSON (Gr a b) where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance (FromJSON a,FromJSON b) => FromJSON (Gr a b)
|
||||
|
||||
instance (FromJSON a, FromJSON b) => FromJSON (Gr a b)
|
||||
|
||||
makeLenses ''PathGraph
|
||||
makeLenses ''PathEdge
|
||||
$( $( derive
|
||||
[d|
|
||||
instance Store a => Deriving (Store (Gr a))
|
||||
|]
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user