module Game.LambdaHack.Content.RuleKind
( RuleContent(..), emptyRuleContent, makeData
#ifdef EXPOSE_INTERNAL
, validateSingle
#endif
) where
import Prelude ()
import Game.LambdaHack.Core.Prelude
import qualified Data.Ini as Ini
import qualified Data.Ini.Types as Ini
import Data.Version
import Game.LambdaHack.Definition.Defs
data RuleContent = RuleContent
{ RuleContent -> String
rtitle :: String
, RuleContent -> X
rXmax :: X
, RuleContent -> X
rYmax :: Y
, RuleContent -> Version
rexeVersion :: Version
, RuleContent -> String
rcfgUIName :: FilePath
, RuleContent -> (String, Config)
rcfgUIDefault :: (String, Ini.Config)
, RuleContent -> X
rwriteSaveClips :: Int
, RuleContent -> X
rleadLevelClips :: Int
, RuleContent -> String
rscoresFile :: FilePath
, RuleContent -> X
rnearby :: Int
, RuleContent -> [Text]
rstairWordCarried :: [Text]
, RuleContent -> Char
rsymbolProjectile :: Char
}
emptyRuleContent :: RuleContent
emptyRuleContent :: RuleContent
emptyRuleContent = $WRuleContent :: String
-> X
-> X
-> Version
-> String
-> (String, Config)
-> X
-> X
-> String
-> X
-> [Text]
-> Char
-> RuleContent
RuleContent
{ rtitle :: String
rtitle = ""
, rXmax :: X
rXmax = 0
, rYmax :: X
rYmax = 0
, rexeVersion :: Version
rexeVersion = [X] -> Version
makeVersion []
, rcfgUIName :: String
rcfgUIName = ""
, rcfgUIDefault :: (String, Config)
rcfgUIDefault = ("", Config
Ini.emptyConfig)
, rwriteSaveClips :: X
rwriteSaveClips = 0
, rleadLevelClips :: X
rleadLevelClips = 0
, rscoresFile :: String
rscoresFile = ""
, rnearby :: X
rnearby = 0
, rstairWordCarried :: [Text]
rstairWordCarried = []
, rsymbolProjectile :: Char
rsymbolProjectile = '0'
}
validateSingle :: RuleContent -> [Text]
validateSingle :: RuleContent -> [Text]
validateSingle _ = []
makeData :: RuleContent -> RuleContent
makeData :: RuleContent -> RuleContent
makeData rc :: RuleContent
rc =
let singleOffenders :: [Text]
singleOffenders = RuleContent -> [Text]
validateSingle RuleContent
rc
in Bool -> RuleContent -> RuleContent
forall a. (?callStack::CallStack) => Bool -> a -> a
assert ([Text] -> Bool
forall a. [a] -> Bool
null [Text]
singleOffenders
Bool -> (String, [Text]) -> Bool
forall a. Show a => Bool -> a -> Bool
`blame` "Rule Content not valid"
String -> [Text] -> (String, [Text])
forall v. String -> v -> (String, v)
`swith` [Text]
singleOffenders)
RuleContent
rc