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
+8 -6
View File
@@ -5,6 +5,8 @@
module Dodge.Data.ActionPlan where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
@@ -24,13 +26,11 @@ data ActionPlan
, _apGoal :: [Goal]
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ActionPlan
data RandImpulse
= RandImpulseList [Impulse]
| RandImpulseCircMove Float
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary RandImpulse
data Impulse
= Move Point2
@@ -65,7 +65,6 @@ data Impulse
}
| ImpulseNothing
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Impulse
infixr 9 `WaitThen`
@@ -173,7 +172,6 @@ data Action
, _mainAction :: Action
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Action
data Strategy
= Flank Int
@@ -192,14 +190,12 @@ data Strategy
| Flee
| MeleeStrike
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Strategy
data Goal
= LiveLongAndProsper
| Kill Int
| SentinelAt Point2 Float
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Goal
deriveJSON defaultOptions ''ActionPlan
deriveJSON defaultOptions ''RandImpulse
@@ -210,3 +206,9 @@ deriveJSON defaultOptions ''Goal
makeLenses ''ActionPlan
makeLenses ''Impulse
makeLenses ''Action
$($(derive [d| instance Deriving (Store Goal) |]))
$($(derive [d| instance Deriving (Store ActionPlan) |]))
$($(derive [d| instance Deriving (Store RandImpulse) |]))
$($(derive [d| instance Deriving (Store Impulse) |]))
$($(derive [d| instance Deriving (Store Action) |]))
$($(derive [d| instance Deriving (Store Strategy) |]))