Add Store instances

This commit is contained in:
2022-08-21 12:21:05 +01:00
parent 1ce7d4a72d
commit dd62e30026
92 changed files with 465 additions and 255 deletions
+6 -3
View File
@@ -17,6 +17,8 @@ module Dodge.Data.Creature (
module Dodge.Data.Hammer,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
@@ -77,11 +79,10 @@ data Creature = Creature
, _crCamouflage :: CamouflageStatus
}
deriving (Eq, Show, Read, Generic, Flat)
instance Binary Creature
data CreatureCorpse = MakeDefaultCorpse
| HackCreatureCorpse
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CreatureCorpse
data Intention = Intention
{ _targetCr :: Maybe Creature
@@ -89,7 +90,6 @@ data Intention = Intention
, _viewPoint :: Maybe Point2
}
deriving (Eq, Show, Read, Generic, Flat)
instance Binary Intention
crSel :: Creature -> Int
crSel = _iselPos . _crInvSel
@@ -99,3 +99,6 @@ makeLenses ''Intention
deriveJSON defaultOptions ''Creature
deriveJSON defaultOptions ''CreatureCorpse
deriveJSON defaultOptions ''Intention
$($(derive [d| instance Deriving (Store Intention ) |]))
$($(derive [d| instance Deriving (Store Creature ) |]))
$($(derive [d| instance Deriving (Store CreatureCorpse ) |]))