refactor(xanthous): Generators -> Generators.Level
I'm going to start adding generators for things like text soon, so it makes sense to specifically sequester level generators as their own thing Change-Id: I175025375204fab7d75eba67dd06dab9bd2939d3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3201 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
6f238c1c90
commit
006e5231e5
11 changed files with 40 additions and 39 deletions
|
@ -13,15 +13,15 @@ import System.Exit (die)
|
||||||
import qualified Xanthous.Game as Game
|
import qualified Xanthous.Game as Game
|
||||||
import Xanthous.Game.Env (GameEnv(..))
|
import Xanthous.Game.Env (GameEnv(..))
|
||||||
import Xanthous.App
|
import Xanthous.App
|
||||||
import Xanthous.Generators
|
import Xanthous.Generators.Level
|
||||||
( GeneratorInput
|
( GeneratorInput
|
||||||
, parseGeneratorInput
|
, parseGeneratorInput
|
||||||
, generateFromInput
|
, generateFromInput
|
||||||
, showCells
|
, showCells
|
||||||
)
|
)
|
||||||
import qualified Xanthous.Entities.Character as Character
|
import qualified Xanthous.Entities.Character as Character
|
||||||
import Xanthous.Generators.Util (regions)
|
import Xanthous.Generators.Level.Util (regions)
|
||||||
import Xanthous.Generators.LevelContents
|
import Xanthous.Generators.Level.LevelContents
|
||||||
import Xanthous.Data (Dimensions, Dimensions'(Dimensions))
|
import Xanthous.Data (Dimensions, Dimensions'(Dimensions))
|
||||||
import Data.Array.IArray ( amap )
|
import Data.Array.IArray ( amap )
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
|
@ -60,9 +60,9 @@ import Xanthous.Entities.RawTypes
|
||||||
( edible, eatMessage, hitpointsHealed
|
( edible, eatMessage, hitpointsHealed
|
||||||
, attackMessage
|
, attackMessage
|
||||||
)
|
)
|
||||||
import Xanthous.Generators
|
import Xanthous.Generators.Level
|
||||||
import qualified Xanthous.Generators.CaveAutomata as CaveAutomata
|
import qualified Xanthous.Generators.Level.CaveAutomata as CaveAutomata
|
||||||
import qualified Xanthous.Generators.Dungeon as Dungeon
|
import qualified Xanthous.Generators.Level.Dungeon as Dungeon
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
type App = Brick.App GameState AppEvent ResourceName
|
type App = Brick.App GameState AppEvent ResourceName
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{-# LANGUAGE GADTs #-}
|
{-# LANGUAGE GADTs #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
module Xanthous.Generators
|
module Xanthous.Generators.Level
|
||||||
( generate
|
( generate
|
||||||
, Generator(..)
|
, Generator(..)
|
||||||
, SGenerator(..)
|
, SGenerator(..)
|
||||||
|
@ -27,11 +27,11 @@ import Data.Array.Unboxed
|
||||||
import qualified Options.Applicative as Opt
|
import qualified Options.Applicative as Opt
|
||||||
import Control.Monad.Random
|
import Control.Monad.Random
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
import qualified Xanthous.Generators.CaveAutomata as CaveAutomata
|
import qualified Xanthous.Generators.Level.CaveAutomata as CaveAutomata
|
||||||
import qualified Xanthous.Generators.Dungeon as Dungeon
|
import qualified Xanthous.Generators.Level.Dungeon as Dungeon
|
||||||
import Xanthous.Generators.Util
|
import Xanthous.Generators.Level.Util
|
||||||
import Xanthous.Generators.LevelContents
|
import Xanthous.Generators.Level.LevelContents
|
||||||
import Xanthous.Generators.Village as Village
|
import Xanthous.Generators.Level.Village as Village
|
||||||
import Xanthous.Data (Dimensions, Position'(Position), Position)
|
import Xanthous.Data (Dimensions, Position'(Position), Position)
|
||||||
import Xanthous.Data.EntityMap (EntityMap, _EntityMap)
|
import Xanthous.Data.EntityMap (EntityMap, _EntityMap)
|
||||||
import qualified Xanthous.Data.EntityMap as EntityMap
|
import qualified Xanthous.Data.EntityMap as EntityMap
|
|
@ -2,7 +2,7 @@
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
module Xanthous.Generators.CaveAutomata
|
module Xanthous.Generators.Level.CaveAutomata
|
||||||
( Params(..)
|
( Params(..)
|
||||||
, defaultParams
|
, defaultParams
|
||||||
, parseParams
|
, parseParams
|
||||||
|
@ -18,7 +18,7 @@ import qualified Options.Applicative as Opt
|
||||||
import Xanthous.Util (between)
|
import Xanthous.Util (between)
|
||||||
import Xanthous.Util.Optparse
|
import Xanthous.Util.Optparse
|
||||||
import Xanthous.Data (Dimensions, width, height)
|
import Xanthous.Data (Dimensions, width, height)
|
||||||
import Xanthous.Generators.Util
|
import Xanthous.Generators.Level.Util
|
||||||
import Linear.V2
|
import Linear.V2
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
module Xanthous.Generators.Dungeon
|
module Xanthous.Generators.Level.Dungeon
|
||||||
( Params(..)
|
( Params(..)
|
||||||
, defaultParams
|
, defaultParams
|
||||||
, parseParams
|
, parseParams
|
||||||
|
@ -24,7 +24,7 @@ import qualified Options.Applicative as Opt
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
import Xanthous.Random
|
import Xanthous.Random
|
||||||
import Xanthous.Data hiding (x, y, _x, _y, edges)
|
import Xanthous.Data hiding (x, y, _x, _y, edges)
|
||||||
import Xanthous.Generators.Util
|
import Xanthous.Generators.Level.Util
|
||||||
import Xanthous.Util.Graphics (delaunay, straightLine)
|
import Xanthous.Util.Graphics (delaunay, straightLine)
|
||||||
import Xanthous.Util.Graph (mstSubGraph)
|
import Xanthous.Util.Graph (mstSubGraph)
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
|
@ -1,5 +1,5 @@
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
module Xanthous.Generators.LevelContents
|
module Xanthous.Generators.Level.LevelContents
|
||||||
( chooseCharacterPosition
|
( chooseCharacterPosition
|
||||||
, randomItems
|
, randomItems
|
||||||
, randomCreatures
|
, randomCreatures
|
||||||
|
@ -16,7 +16,7 @@ import qualified Data.Array.IArray as Arr
|
||||||
import Data.Foldable (any, toList)
|
import Data.Foldable (any, toList)
|
||||||
import Linear.V2
|
import Linear.V2
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
import Xanthous.Generators.Util
|
import Xanthous.Generators.Level.Util
|
||||||
import Xanthous.Random
|
import Xanthous.Random
|
||||||
import Xanthous.Data
|
import Xanthous.Data
|
||||||
( positionFromV2, Position, _Position
|
( positionFromV2, Position, _Position
|
|
@ -1,7 +1,7 @@
|
||||||
{-# LANGUAGE QuantifiedConstraints #-}
|
{-# LANGUAGE QuantifiedConstraints #-}
|
||||||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
module Xanthous.Generators.Util
|
module Xanthous.Generators.Level.Util
|
||||||
( MCells
|
( MCells
|
||||||
, Cells
|
, Cells
|
||||||
, CellM
|
, CellM
|
|
@ -1,4 +1,5 @@
|
||||||
module Xanthous.Generators.Village
|
--------------------------------------------------------------------------------
|
||||||
|
module Xanthous.Generators.Level.Village
|
||||||
( fromCave
|
( fromCave
|
||||||
) where
|
) where
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -15,7 +16,7 @@ import Xanthous.Data
|
||||||
import Xanthous.Data.EntityMap (EntityMap)
|
import Xanthous.Data.EntityMap (EntityMap)
|
||||||
import qualified Xanthous.Data.EntityMap as EntityMap
|
import qualified Xanthous.Data.EntityMap as EntityMap
|
||||||
import Xanthous.Entities.Environment
|
import Xanthous.Entities.Environment
|
||||||
import Xanthous.Generators.Util
|
import Xanthous.Generators.Level.Util
|
||||||
import Xanthous.Game.State (SomeEntity(..))
|
import Xanthous.Game.State (SomeEntity(..))
|
||||||
import Xanthous.Random
|
import Xanthous.Random
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
|
@ -11,7 +11,7 @@ import qualified Xanthous.Data.NestedMapSpec
|
||||||
import qualified Xanthous.DataSpec
|
import qualified Xanthous.DataSpec
|
||||||
import qualified Xanthous.Entities.RawsSpec
|
import qualified Xanthous.Entities.RawsSpec
|
||||||
import qualified Xanthous.GameSpec
|
import qualified Xanthous.GameSpec
|
||||||
import qualified Xanthous.Generators.UtilSpec
|
import qualified Xanthous.Generators.Level.UtilSpec
|
||||||
import qualified Xanthous.MessageSpec
|
import qualified Xanthous.MessageSpec
|
||||||
import qualified Xanthous.Messages.TemplateSpec
|
import qualified Xanthous.Messages.TemplateSpec
|
||||||
import qualified Xanthous.OrphansSpec
|
import qualified Xanthous.OrphansSpec
|
||||||
|
@ -36,7 +36,7 @@ test = testGroup "Xanthous"
|
||||||
, Xanthous.DataSpec.test
|
, Xanthous.DataSpec.test
|
||||||
, Xanthous.Entities.RawsSpec.test
|
, Xanthous.Entities.RawsSpec.test
|
||||||
, Xanthous.GameSpec.test
|
, Xanthous.GameSpec.test
|
||||||
, Xanthous.Generators.UtilSpec.test
|
, Xanthous.Generators.Level.UtilSpec.test
|
||||||
, Xanthous.MessageSpec.test
|
, Xanthous.MessageSpec.test
|
||||||
, Xanthous.Messages.TemplateSpec.test
|
, Xanthous.Messages.TemplateSpec.test
|
||||||
, Xanthous.OrphansSpec.test
|
, Xanthous.OrphansSpec.test
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{-# LANGUAGE PackageImports #-}
|
{-# LANGUAGE PackageImports #-}
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
module Xanthous.Generators.UtilSpec (main, test) where
|
module Xanthous.Generators.Level.UtilSpec (main, test) where
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
import Test.Prelude
|
import Test.Prelude
|
||||||
import System.Random (mkStdGen)
|
import System.Random (mkStdGen)
|
||||||
|
@ -15,7 +15,7 @@ import Linear.V2
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
import Xanthous.Util
|
import Xanthous.Util
|
||||||
import Xanthous.Data (width, height)
|
import Xanthous.Data (width, height)
|
||||||
import Xanthous.Generators.Util
|
import Xanthous.Generators.Level.Util
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
|
@ -4,7 +4,7 @@ cabal-version: 1.12
|
||||||
--
|
--
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
--
|
--
|
||||||
-- hash: f642cb264ff0785d5883884fa8db14adb92ce3d897cfc22e69555089dbc8dfd2
|
-- hash: bba18b2b297d73ddcb0a2c365e597a183e6b612ad336e97ca06d9ce87b989656
|
||||||
|
|
||||||
name: xanthous
|
name: xanthous
|
||||||
version: 0.1.0.0
|
version: 0.1.0.0
|
||||||
|
@ -65,12 +65,12 @@ library
|
||||||
Xanthous.Game.Memo
|
Xanthous.Game.Memo
|
||||||
Xanthous.Game.Prompt
|
Xanthous.Game.Prompt
|
||||||
Xanthous.Game.State
|
Xanthous.Game.State
|
||||||
Xanthous.Generators
|
Xanthous.Generators.Level
|
||||||
Xanthous.Generators.CaveAutomata
|
Xanthous.Generators.Level.CaveAutomata
|
||||||
Xanthous.Generators.Dungeon
|
Xanthous.Generators.Level.Dungeon
|
||||||
Xanthous.Generators.LevelContents
|
Xanthous.Generators.Level.LevelContents
|
||||||
Xanthous.Generators.Util
|
Xanthous.Generators.Level.Util
|
||||||
Xanthous.Generators.Village
|
Xanthous.Generators.Level.Village
|
||||||
Xanthous.Messages
|
Xanthous.Messages
|
||||||
Xanthous.Messages.Template
|
Xanthous.Messages.Template
|
||||||
Xanthous.Monad
|
Xanthous.Monad
|
||||||
|
@ -221,12 +221,12 @@ executable xanthous
|
||||||
Xanthous.Game.Memo
|
Xanthous.Game.Memo
|
||||||
Xanthous.Game.Prompt
|
Xanthous.Game.Prompt
|
||||||
Xanthous.Game.State
|
Xanthous.Game.State
|
||||||
Xanthous.Generators
|
Xanthous.Generators.Level
|
||||||
Xanthous.Generators.CaveAutomata
|
Xanthous.Generators.Level.CaveAutomata
|
||||||
Xanthous.Generators.Dungeon
|
Xanthous.Generators.Level.Dungeon
|
||||||
Xanthous.Generators.LevelContents
|
Xanthous.Generators.Level.LevelContents
|
||||||
Xanthous.Generators.Util
|
Xanthous.Generators.Level.Util
|
||||||
Xanthous.Generators.Village
|
Xanthous.Generators.Level.Village
|
||||||
Xanthous.Messages
|
Xanthous.Messages
|
||||||
Xanthous.Messages.Template
|
Xanthous.Messages.Template
|
||||||
Xanthous.Monad
|
Xanthous.Monad
|
||||||
|
@ -353,7 +353,7 @@ test-suite test
|
||||||
Xanthous.DataSpec
|
Xanthous.DataSpec
|
||||||
Xanthous.Entities.RawsSpec
|
Xanthous.Entities.RawsSpec
|
||||||
Xanthous.GameSpec
|
Xanthous.GameSpec
|
||||||
Xanthous.Generators.UtilSpec
|
Xanthous.Generators.Level.UtilSpec
|
||||||
Xanthous.Messages.TemplateSpec
|
Xanthous.Messages.TemplateSpec
|
||||||
Xanthous.MessageSpec
|
Xanthous.MessageSpec
|
||||||
Xanthous.OrphansSpec
|
Xanthous.OrphansSpec
|
||||||
|
|
Loading…
Reference in a new issue