Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Package move to Roguestar.Lib.

  • Loading branch information...
commit eb4b7b81ee5e7595d67fb0a54c9c077a40793c76 1 parent 1954e7c
@clanehin authored
Showing with 1,184 additions and 604 deletions.
  1. +0 −37 .boring
  2. +0 −43 README
  3. +6 −6 {src → Roguestar/Lib}/Activate.hs
  4. +1 −1  {src → Roguestar/Lib}/Alignment.hs
  5. +1 −1  {src → Roguestar/Lib}/AttributeGeneration.hs
  6. +16 −16 {src → Roguestar/Lib}/BeginGame.hs
  7. +23 −23 {src → Roguestar/Lib}/Behavior.hs
  8. +12 −11 {src → Roguestar/Lib}/Building.hs
  9. +4 −4 {src → Roguestar/Lib}/BuildingData.hs
  10. +6 −6 {src → Roguestar/Lib}/Character.hs
  11. +4 −4 {src → Roguestar/Lib}/CharacterAdvancement.hs
  12. +2 −2 {src → Roguestar/Lib}/CharacterData.hs
  13. +11 −11 {src → Roguestar/Lib}/Combat.hs
  14. +7 −7 {src → Roguestar/Lib}/Construction.hs
  15. +9 −9 {src → Roguestar/Lib}/Contact.hs
  16. +13 −13 {src → Roguestar/Lib}/Creature.hs
  17. +10 −10 {src → Roguestar/Lib}/CreatureAttribute.hs
  18. +6 −6 {src → Roguestar/Lib}/CreatureData.hs
  19. +20 −20 {src → Roguestar/Lib}/DB.hs
  20. +9 −9 {src → Roguestar/Lib}/DBData.hs
  21. +1 −1  {src → Roguestar/Lib}/DBErrorFlag.hs
  22. +9 −9 {src → Roguestar/Lib}/DBPrivate.hs
  23. +9 −9 {src → Roguestar/Lib}/DetailedLocation.hs
  24. +6 −6 {src → Roguestar/Lib}/DetailedTravel.hs
  25. +5 −5 {src → Roguestar/Lib}/DeviceActivation.hs
  26. +2 −2 {src → Roguestar/Lib}/Facing.hs
  27. +1 −1  {src → Roguestar/Lib}/FactionData.hs
  28. +2 −2 {src → Roguestar/Lib}/GridRayCaster.hs
  29. +3 −3 {src → Roguestar/Lib}/Grids.hs
  30. +24 −23 {src → Roguestar/Lib}/HierarchicalDatabase.hs
  31. +1 −1  {src → Roguestar/Lib}/Logging.hs
  32. +1 −1  {src → Roguestar/Lib}/Main.hs
  33. +6 −6 {src → Roguestar/Lib}/Make.hs
  34. +4 −4 {src → Roguestar/Lib}/MakeData.hs
  35. +20 −19 {src → Roguestar/Lib}/Perception.hs
  36. +1 −1  {src → Roguestar/Lib}/PersistantData.hs
  37. +18 −17 {src → Roguestar/Lib}/Plane.hs
  38. +2 −2 {src → Roguestar/Lib}/PlaneData.hs
  39. +15 −15 {src → Roguestar/Lib}/PlaneVisibility.hs
  40. +10 −9 {src → Roguestar/Lib}/Planet.hs
  41. +4 −4 {src → Roguestar/Lib}/PlanetData.hs
  42. +6 −6 {src → Roguestar/Lib}/PlayerState.hs
  43. +1 −1  {src → Roguestar/Lib}/Position.hs
  44. +6 −0 Roguestar/Lib/PowerUpData.hs
  45. 0  {src → Roguestar/Lib}/Protocol.hs
  46. +1 −1  {src → Roguestar/Lib}/RNG.hs
  47. +1 −1  {src → Roguestar/Lib}/Random.hs
  48. +6 −6 {src → Roguestar/Lib}/Reference.hs
  49. +6 −6 {src → Roguestar/Lib}/Species.hs
  50. +1 −1  {src → Roguestar/Lib}/SpeciesData.hs
  51. +3 −3 {src → Roguestar/Lib}/Substances.hs
  52. +3 −3 {src → Roguestar/Lib}/TerrainData.hs
  53. +1 −1  {src → Roguestar/Lib}/Tests.hs
  54. +14 −0 Roguestar/Lib/TimeCoordinate.hs
  55. +8 −8 {src → Roguestar/Lib}/Tool.hs
  56. +2 −2 {src → Roguestar/Lib}/ToolData.hs
  57. +5 −5 {src → Roguestar/Lib}/Town.hs
  58. +12 −12 {src → Roguestar/Lib}/Travel.hs
  59. +1 −1  {src → Roguestar/Lib}/TravelData.hs
  60. +17 −16 {src → Roguestar/Lib}/Turns.hs
  61. +3 −3 {src → Roguestar/Lib}/VisibilityData.hs
  62. +23 −0 Roguestar/Server/Main.hs
  63. +99 −27 roguestar.cabal
  64. +0 −6 src/PowerUpData.hs
  65. +0 −24 src/TimeCoordinate.hs
  66. +0 −92 src/WorkCluster.hs
  67. +661 −0 static/LICENSE.txt
View
37 .boring
@@ -1,37 +0,0 @@
-# Boring file regexps:
-(^|/)haddock($|/)
-(^|/)products($|/)
-\.hi$
-\.o$
-\.o\.cmd$
-# *.ko files aren't boring by default because they might
-# be Korean translations rather than kernel modules.
-# \.ko$
-\.ko\.cmd$
-\.mod\.c$
-(^|/)\.tmp_versions($|/)
-(^|/)CVS($|/)
-(^|/)RCS($|/)
-~$
-#(^|/)\.[^/]
-(^|/)_darcs($|/)
-\.bak$
-\.BAK$
-\.orig$
-(^|/)vssver\.scc$
-\.swp$
-(^|/)MT($|/)
-(^|/)\{arch\}($|/)
-(^|/).arch-ids($|/)
-(^|/),
-\.class$
-\.prof$
-(^|/)\.DS_Store$
-(^|/)BitKeeper($|/)
-(^|/)ChangeSet($|/)
-(^|/)\.svn($|/)
-\.py[co]$
-\#
-\.cvsignore$
-(^|/)Thumbs\.db$
-(^|/)autom4te\.cache($|/)
View
43 README
@@ -1,43 +0,0 @@
-Roguestar: Meta-Package / Maintainer's Package README
-=====================================================
-
-This git repository contains all of the packages that make up roguestar.
-
-The binary packages:
-
-* roguestar-engine
-* roguestar-gl
-* rsagl-demos
-
-And the library packages:
-
-* rsagl (RogueStar Animation and Graphics Library)
-* rsagl-math
-* rsagl-frp
-
-The library packages must be installed before the binary packages can
-even be configured.
-
-Maintainer Scripts
-------------------
-
-To facilitate maintenance, there is a `Makefile` that contains
-numerous convenient maintainer scripts.
-
-install-deps [-e OPTS=cabal install opts]
-: Use cabal to install all dependencies not in the
-: haskell-platform.
-
-clean [-e OPTS=cabal clean opts]
-: Restore everything to a pristine state.
-
-install [-e OPTS=cabal install opts]
-: Install everything using cabal.
-
-dev [-e OPTS=cabal install opts]
-: Install everything using cabal, with -Wall on.
-
-sdist -e "VERSION=0.5" [-e OPTS=cabal sdist opts]
-: Perform a cabal sdist, and gather everything under roguestar-sdist.
-: The version parameter is required and must reflect the version number in cabal.
-
View
12 src/Activate.hs → Roguestar/Lib/Activate.hs
@@ -1,15 +1,15 @@
-module Activate
+module Roguestar.Lib.Activate
(ActivationOutcome,
resolveActivation,
executeActivation)
where
-import Tool
-import ToolData
-import Creature
-import DB
+import Roguestar.Lib.Tool
+import Roguestar.Lib.ToolData
+import Roguestar.Lib.Creature
+import Roguestar.Lib.DB
import Control.Monad.Error
-import Substances
+import Roguestar.Lib.Substances
-- | Outcome of activating a tool.
data ActivationOutcome =
View
2  src/Alignment.hs → Roguestar/Lib/Alignment.hs
@@ -1,4 +1,4 @@
-module Alignment
+module Roguestar.Lib.Alignment
(Alignment,
MoralAlignment(..),
EthicalAlignment(..),
View
2  src/AttributeGeneration.hs → Roguestar/Lib/AttributeGeneration.hs
@@ -1,7 +1,7 @@
-- | Generates random lists of specific data points "attributes" of any data type.
-- The attributes themselves aren't random, only their arrangement and frequency within the list.
--
-module AttributeGeneration
+module Roguestar.Lib.AttributeGeneration
where
import Data.Ratio
View
32 src/BeginGame.hs → Roguestar/Lib/BeginGame.hs
@@ -1,24 +1,24 @@
{-# LANGUAGE OverloadedStrings #-}
-module BeginGame
+module Roguestar.Lib.BeginGame
(dbBeginGame)
where
-import Plane
-import CreatureData
-import Character
-import CharacterData
-import BuildingData
-import DB
-import Facing
-import TerrainData
-import ToolData
+import Roguestar.Lib.Plane
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.Character
+import Roguestar.Lib.CharacterData
+import Roguestar.Lib.BuildingData
+import Roguestar.Lib.DB
+import Roguestar.Lib.Facing
+import Roguestar.Lib.TerrainData
+import Roguestar.Lib.ToolData
import Control.Monad
-import SpeciesData
-import Substances
-import PlayerState
-import Town
-import PlanetData
-import Planet
+import Roguestar.Lib.SpeciesData
+import Roguestar.Lib.Substances as Substances
+import Roguestar.Lib.PlayerState
+import Roguestar.Lib.Town
+import Roguestar.Lib.PlanetData
+import Roguestar.Lib.Planet
import qualified Data.ByteString.Char8 as B ()
homeBiome :: Species -> Biome
View
46 src/Behavior.hs → Roguestar/Lib/Behavior.hs
@@ -1,38 +1,38 @@
{-# LANGUAGE ExistentialQuantification, Rank2Types, ScopedTypeVariables #-}
-module Behavior
+module Roguestar.Lib.Behavior
(Behavior(..),
facingBehavior,
dbBehave)
where
import Prelude hiding (getContents)
-import DB
-import Logging
-import Position
-import Facing
+import Roguestar.Lib.DB
+import Roguestar.Lib.Logging
+import Roguestar.Lib.Position
+import Roguestar.Lib.Facing
import Data.Ratio
-import Tool
-import ToolData
+import Roguestar.Lib.Tool
+import Roguestar.Lib.ToolData
import Control.Monad.Error
-import Combat
-import Activate
-import Travel
-import TravelData
-import Creature
-import CreatureData
-import Plane
-import PlaneVisibility
+import Roguestar.Lib.Combat
+import Roguestar.Lib.Activate
+import Roguestar.Lib.Travel
+import Roguestar.Lib.TravelData
+import Roguestar.Lib.Creature
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.Plane
+import Roguestar.Lib.PlaneVisibility
import Data.List
import Control.Monad.Maybe
-import TerrainData
-import Make
-import Construction
-import Building
-import Reference
-import DetailedLocation
-import Plane
-import PlaneData
+import Roguestar.Lib.TerrainData
+import Roguestar.Lib.Make
+import Roguestar.Lib.Construction
+import Roguestar.Lib.Building
+import Roguestar.Lib.Reference
+import Roguestar.Lib.DetailedLocation
+import Roguestar.Lib.Plane
+import Roguestar.Lib.PlaneData
--
-- Every possible behavior that a creature might take, AI or Human.
View
23 src/Building.hs → Roguestar/Lib/Building.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE ScopedTypeVariables #-}
-module Building
+module Roguestar.Lib.Building
(buildingSize,
buildingShape,
buildingBehavior,
@@ -9,20 +9,21 @@ module Building
where
import Prelude hiding (getContents)
-import DB
-import BuildingData
+import Roguestar.Lib.DB
+import Roguestar.Lib.BuildingData
import Data.List
-import Facing
+import Roguestar.Lib.Facing
import Data.Maybe
import Control.Monad.Maybe
-import PlaneData
-import Plane
-import Position
-import TerrainData
+import Control.Monad.Random
+import Roguestar.Lib.PlaneData
+import Roguestar.Lib.Plane
+import Roguestar.Lib.Position
+import Roguestar.Lib.TerrainData
import Control.Monad.Error
-import PowerUpData
-import CharacterAdvancement
-import DetailedLocation
+import Roguestar.Lib.PowerUpData
+import Roguestar.Lib.CharacterAdvancement
+import Roguestar.Lib.DetailedLocation
-- | The total occupied surface area of a building.
buildingSize :: (DBReadable db) => BuildingRef -> db Integer
View
8 src/BuildingData.hs → Roguestar/Lib/BuildingData.hs
@@ -1,5 +1,5 @@
-module BuildingData
+module Roguestar.Lib.BuildingData
(Building(..),
BuildingBehavior(..),
BuildingShape(..),
@@ -12,9 +12,9 @@ module BuildingData
buildingOccupies)
where
-import PowerUpData
-import CharacterData
-import PersistantData
+import Roguestar.Lib.PowerUpData
+import Roguestar.Lib.CharacterData
+import Roguestar.Lib.PersistantData
basic_stargate :: BuildingPrototype
basic_stargate = BuildingPrototype (TwoWayStargate NonAlignedRegion) Portal (Just Magnetic)
View
12 src/Character.hs → Roguestar/Lib/Character.hs
@@ -1,15 +1,15 @@
-module Character
+module Roguestar.Lib.Character
(getEligableCharacterClasses,
getEligableBaseCharacterClasses,
applyCharacterClass)
where
-import Alignment
-import CharacterData
-import CreatureAttribute
-import CreatureData
-import TerrainData
+import Roguestar.Lib.Alignment
+import Roguestar.Lib.CharacterData
+import Roguestar.Lib.CreatureAttribute
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.TerrainData
type Prerequisite = Creature -> Bool
View
8 src/CharacterAdvancement.hs → Roguestar/Lib/CharacterAdvancement.hs
@@ -1,4 +1,4 @@
-module CharacterAdvancement
+module Roguestar.Lib.CharacterAdvancement
(CharacterBumpResult(..),
characterFitness,
bumpCharacter,
@@ -8,9 +8,9 @@ module CharacterAdvancement
where
import qualified Data.Map as Map
-import CreatureData
-import CharacterData
-import PowerUpData
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.CharacterData
+import Roguestar.Lib.PowerUpData
data CharacterBumpResult =
CharacterAwarded { character_points_awarded :: Integer,
View
4 src/CharacterData.hs → Roguestar/Lib/CharacterData.hs
@@ -1,11 +1,11 @@
-module CharacterData
+module Roguestar.Lib.CharacterData
(CharacterClass(..),
all_character_classes,
base_character_classes)
where
-import PersistantData
+import Roguestar.Lib.PersistantData
all_character_classes :: [CharacterClass]
all_character_classes = [minBound..maxBound]
View
22 src/Combat.hs → Roguestar/Lib/Combat.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE PatternGuards, FlexibleContexts #-}
-module Combat
+module Roguestar.Lib.Combat
(AttackModel,
meleeAttackModel,
rangedAttackModel,
@@ -8,18 +8,18 @@ module Combat
executeAttack)
where
-import DB
-import Creature
-import CreatureData
-import Tool
-import ToolData
+import Roguestar.Lib.DB
+import Roguestar.Lib.Creature
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.Tool
+import Roguestar.Lib.ToolData
import Control.Monad.Error
-import Facing
+import Roguestar.Lib.Facing
import Data.Maybe
-import DeviceActivation
-import Contact
-import Plane
-import DetailedLocation
+import Roguestar.Lib.DeviceActivation
+import Roguestar.Lib.Contact
+import Roguestar.Lib.Plane as Plane
+import Roguestar.Lib.DetailedLocation
data AttackModel =
RangedAttackModel CreatureRef ToolRef Device
View
14 src/Construction.hs → Roguestar/Lib/Construction.hs
@@ -1,20 +1,20 @@
{-# LANGUAGE ScopedTypeVariables #-}
-- | All construction (terrain clearing, etc) actions that a creature might take.
-module Construction
+module Roguestar.Lib.Construction
(modifyFacingTerrain,
clearTerrain)
where
-import DB
-import Plane
-import PlaneData
-import TerrainData
-import Facing
+import Roguestar.Lib.DB
+import Roguestar.Lib.Plane
+import Roguestar.Lib.PlaneData
+import Roguestar.Lib.TerrainData
+import Roguestar.Lib.Facing
import Control.Monad
import Control.Monad.Maybe
import Control.Monad.Trans
-import Position
+import Roguestar.Lib.Position
import Data.Maybe
-- | Modifies terrain in the specified walking direction, returning
View
18 src/Contact.hs → Roguestar/Lib/Contact.hs
@@ -1,24 +1,24 @@
{-# LANGUAGE FlexibleContexts, ScopedTypeVariables #-}
-module Contact
+module Roguestar.Lib.Contact
(findContacts,
ContactMode(..),
ContactModeType(..))
where
import Prelude hiding (getContents)
-import Position
-import Facing
-import DB
-import Reference
-import CreatureData
+import Roguestar.Lib.Position as Position
+import Roguestar.Lib.Facing
+import Roguestar.Lib.DB
+import Roguestar.Lib.Reference
+import Roguestar.Lib.CreatureData
import Control.Monad
-import Plane
-import PlaneData
+import Roguestar.Lib.Plane
+import Roguestar.Lib.PlaneData
import Data.Ord
import Data.List as List
import Data.Maybe
-import DetailedLocation
+import Roguestar.Lib.DetailedLocation
-- | 'Touch' contacts are on the same or facing square as the subject.
-- 'Line' contacts are on any point starting on the same square and anywhere directly along a line traced in the
View
26 src/Creature.hs → Roguestar/Lib/Creature.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE TypeFamilies, PatternGuards #-}
-module Creature
+module Roguestar.Lib.Creature
(generateInitialPlayerCreature,
newCreature,
Roll(..),
@@ -19,21 +19,21 @@ module Creature
where
import Prelude hiding (getContents)
-import CreatureData
-import DB
-import SpeciesData
-import Species
-import FactionData
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.DB
+import Roguestar.Lib.SpeciesData
+import Roguestar.Lib.Species
+import Roguestar.Lib.FactionData
import Control.Monad.Error
-import Tool
-import CreatureAttribute
+import Roguestar.Lib.Tool
+import Roguestar.Lib.CreatureAttribute
import Data.Monoid
import Data.Ratio
-import Facing
-import Position
-import Plane
-import PlayerState
-import DetailedLocation
+import Roguestar.Lib.Facing
+import Roguestar.Lib.Position
+import Roguestar.Lib.Plane
+import Roguestar.Lib.PlayerState
+import Roguestar.Lib.DetailedLocation
-- |
-- Generates a new Creature from the specified species.
View
20 src/CreatureAttribute.hs → Roguestar/Lib/CreatureAttribute.hs
@@ -1,21 +1,21 @@
-module CreatureAttribute
+module Roguestar.Lib.CreatureAttribute
(CreatureAttribute,
CreatureAttributeGenerator,
gender,
- CreatureAttribute.attributeStatic,
- CreatureAttribute.attributeMinMax,
+ Roguestar.Lib.CreatureAttribute.attributeStatic,
+ Roguestar.Lib.CreatureAttribute.attributeMinMax,
AG.attributeChoice,
AG.attributeChoices,
- CreatureAttribute.generateAttributes,
+ Roguestar.Lib.CreatureAttribute.generateAttributes,
(&))
where
import Data.Monoid
-import AttributeGeneration as AG
-import CreatureData
+import Roguestar.Lib.AttributeGeneration as AG
+import Roguestar.Lib.CreatureData
import Control.Monad.Random
-import FactionData
-import SpeciesData
+import Roguestar.Lib.FactionData
+import Roguestar.Lib.SpeciesData
newtype CreatureAttribute = CreatureAttribute { fromCreatureAttribute :: Endo Creature }
@@ -31,8 +31,8 @@ type CreatureAttributeGenerator = AttributeGenerator CreatureAttribute
-- Generate a ratio of males to females.
--
gender :: Rational -> CreatureAttributeGenerator
-gender r = AG.attributeChoice r [CreatureAttribute.attributeStatic 1 Male]
- [CreatureAttribute.attributeStatic 1 Female]
+gender r = AG.attributeChoice r [Roguestar.Lib.CreatureAttribute.attributeStatic 1 Male]
+ [Roguestar.Lib.CreatureAttribute.attributeStatic 1 Female]
attributeStatic :: (CreatureEndo a) => Integer -> a -> CreatureAttributeGenerator
attributeStatic n a = AG.attributeStatic n (CreatureAttribute $ Endo $ applyToCreature a)
View
12 src/CreatureData.hs → Roguestar/Lib/CreatureData.hs
@@ -1,5 +1,5 @@
-module CreatureData
+module Roguestar.Lib.CreatureData
(Creature(..),
CreatureGender(..),
CreatureAptitude(..),
@@ -14,15 +14,15 @@ module CreatureData
empty_creature)
where
-import CharacterData
-import Alignment
+import Roguestar.Lib.CharacterData
+import Roguestar.Lib.Alignment
import Data.Maybe
-import FactionData
+import Roguestar.Lib.FactionData
import Data.Monoid
import qualified Data.Map as Map
import qualified Data.Set as Set
-import SpeciesData
-import TerrainData
+import Roguestar.Lib.SpeciesData
+import Roguestar.Lib.TerrainData
data Creature = Creature { creature_aptitude :: Map.Map CreatureAptitude Integer,
creature_ability :: Map.Map CreatureAbility Integer,
View
40 src/DB.hs → Roguestar/Lib/DB.hs
@@ -6,7 +6,7 @@
ScopedTypeVariables,
TypeFamilies #-}
-module DB
+module Roguestar.Lib.DB
(DBResult,
DB,
runDB,
@@ -49,39 +49,39 @@ module DB
dbPeepOldestSnapshot,
dbPopOldestSnapshot,
dbHasSnapshot,
- module DBData,
- module DBErrorFlag,
- module Random)
+ module Roguestar.Lib.DBData,
+ module Roguestar.Lib.DBErrorFlag,
+ module Roguestar.Lib.Random)
where
import Prelude hiding (getContents)
-import DBPrivate
-import DBData
-import Reference
-import CreatureData
-import PlaneData
-import BuildingData
-import RNG
+import Roguestar.Lib.DBPrivate
+import Roguestar.Lib.DBData
+import Roguestar.Lib.Reference
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.PlaneData
+import Roguestar.Lib.BuildingData
+import Roguestar.Lib.RNG
import Data.Map as Map
import Data.List as List
-import qualified HierarchicalDatabase as HD
-import SpeciesData
+import qualified Roguestar.Lib.HierarchicalDatabase as HD
+import Roguestar.Lib.SpeciesData
import Data.Maybe
-import ToolData
+import Roguestar.Lib.ToolData
import Control.Monad.State
import Control.Monad.Error
import Control.Monad.Reader
import Control.Applicative
-import TimeCoordinate
+import Roguestar.Lib.TimeCoordinate
import Data.Ord
import Control.Arrow (first,second)
import Control.Monad.Random as Random
-import Random
-import PlayerState
-import DBErrorFlag
+import Roguestar.Lib.Random
+import Roguestar.Lib.PlayerState
+import Roguestar.Lib.DBErrorFlag
import Control.Parallel.Strategies
import System.IO.Unsafe
-import Logging
+import Roguestar.Lib.Logging
data DB_History = DB_History {
db_here :: DB_BaseType,
@@ -430,7 +430,7 @@ setLocation loc =
--
shuntPlane :: (LocationDetail a) => (a -> Bool) -> PlaneRef -> DB ()
shuntPlane f p =
- do locations <- liftM (List.filter (maybe False f . fromLocation)) $ DB.getContents p
+ do locations <- liftM (List.filter (maybe False f . fromLocation)) $ getContents p
mapM_ (maybe (return ()) setLocation . shuntToTheUniverse) locations
-- |
View
18 src/DBData.hs → Roguestar/Lib/DBData.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE ScopedTypeVariables, PatternGuards, TypeFamilies #-}
-module DBData
+module Roguestar.Lib.DBData
(Reference,
toUID,
genericReference,
@@ -30,16 +30,16 @@ module DBData
shuntToTheUniverse)
where
-import Facing
-import DBPrivate
-import ToolData
-import CreatureData
-import PlaneData
-import BuildingData
+import Roguestar.Lib.Facing
+import Roguestar.Lib.DBPrivate
+import Roguestar.Lib.ToolData
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.PlaneData
+import Roguestar.Lib.BuildingData
import Data.Maybe
import Control.Monad
-import Position
-import Reference
+import Roguestar.Lib.Position
+import Roguestar.Lib.Reference
--
-- Getting References generically.
View
2  src/DBErrorFlag.hs → Roguestar/Lib/DBErrorFlag.hs
@@ -1,4 +1,4 @@
-module DBErrorFlag
+module Roguestar.Lib.DBErrorFlag
(ErrorFlag(..))
where
View
18 src/DBPrivate.hs → Roguestar/Lib/DBPrivate.hs
@@ -1,4 +1,4 @@
-module DBPrivate
+module Roguestar.Lib.DBPrivate
(Reference(..),
unsafeReference,
toUID,
@@ -18,14 +18,14 @@ module DBPrivate
BuildingRef)
where
-import HierarchicalDatabase
-import Facing
-import CreatureData
-import ToolData
-import PlaneData
-import BuildingData
-import PlanetData
-import Position
+import Roguestar.Lib.HierarchicalDatabase
+import Roguestar.Lib.Facing
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.ToolData
+import Roguestar.Lib.PlaneData
+import Roguestar.Lib.BuildingData
+import Roguestar.Lib.PlanetData
+import Roguestar.Lib.Position
--
-- For References and Locations we make considerable use of phantom types
View
18 src/DetailedLocation.hs → Roguestar/Lib/DetailedLocation.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE TypeFamilies, EmptyDataDecls, ScopedTypeVariables, PatternGuards, FlexibleContexts #-}
-module DetailedLocation
+module Roguestar.Lib.DetailedLocation
(DetailedLocation,
PlaneLocation,
BuildingLocation,
@@ -16,16 +16,16 @@ module DetailedLocation
LocationAssignmentTable)
where
-import DBData
-import PlaneData
-import BuildingData
-import ToolData
-import CreatureData
-import Position
+import Roguestar.Lib.DBData
+import Roguestar.Lib.PlaneData
+import Roguestar.Lib.BuildingData
+import Roguestar.Lib.ToolData
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.Position
import Data.Maybe
import Control.Monad
-import Reference
-import Facing
+import Roguestar.Lib.Reference
+import Roguestar.Lib.Facing
type PlaneLocation = DetailedLocation (Child Plane)
type BuildingLocation = DetailedLocation (Child Building)
View
12 src/DetailedTravel.hs → Roguestar/Lib/DetailedTravel.hs
@@ -1,16 +1,16 @@
{-# LANGUAGE TypeFamilies #-}
-module DetailedTravel
- (DetailedTravel.whereIs,
- DetailedTravel.getContents)
+module Roguestar.Lib.DetailedTravel
+ (Roguestar.Lib.DetailedTravel.whereIs,
+ Roguestar.Lib.DetailedTravel.getContents)
where
import Prelude hiding (getContents)
-import DB
-import DetailedLocation
+import Roguestar.Lib.DB as DB
+import Roguestar.Lib.DetailedLocation
import Control.Monad
import Data.Maybe
-import Reference
+import Roguestar.Lib.Reference
whereIs :: (DBReadable db,ReferenceType a) => Reference a -> db (DetailedLocation (Child a))
whereIs = liftM (fromMaybe (error "DetailedTravel.whereIs: Reference is not a child of it's own location.") . fromLocation) . DB.whereIs
View
10 src/DeviceActivation.hs → Roguestar/Lib/DeviceActivation.hs
@@ -1,13 +1,13 @@
-module DeviceActivation
+module Roguestar.Lib.DeviceActivation
(DeviceActivationOutcomeType(..),
DeviceActivationOutcome(..),
resolveDeviceActivation)
where
-import DB
-import Creature
-import CreatureData
-import ToolData
+import Roguestar.Lib.DB
+import Roguestar.Lib.Creature
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.ToolData
import Data.Ratio
data DeviceActivationOutcomeType =
View
4 src/Facing.hs → Roguestar/Lib/Facing.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
-module Facing
+module Roguestar.Lib.Facing
(Facing(..),
facingToRelative,
facingToRelative7,
@@ -9,7 +9,7 @@ module Facing
faceAt)
where
-import Position
+import Roguestar.Lib.Position
import Data.Ord
import Data.List
import qualified Data.ByteString.Char8 as B
View
2  src/FactionData.hs → Roguestar/Lib/FactionData.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
-module FactionData
+module Roguestar.Lib.FactionData
(Faction(..),factionPrefix)
where
View
4 src/GridRayCaster.hs → Roguestar/Lib/GridRayCaster.hs
@@ -1,5 +1,5 @@
-module GridRayCaster
+module Roguestar.Lib.GridRayCaster
(castRays,
castRay,
gridRayCasterTests)
@@ -8,7 +8,7 @@ module GridRayCaster
import Data.Set as Set
import Data.List as List
import Data.Ratio
-import Tests
+import Roguestar.Lib.Tests
-- |
-- When casting large numbers of rays from the same point, castRays will try to do this in
View
6 src/Grids.hs → Roguestar/Lib/Grids.hs
@@ -1,4 +1,4 @@
-module Grids
+module Roguestar.Lib.Grids
(Grid,
gridAt,
generateGrid,
@@ -6,11 +6,11 @@ module Grids
specificReplaceGrid)
where
-import RNG
+import Roguestar.Lib.RNG
import Data.Map as Map
import Data.Ratio
import Data.List as List
-import Random
+import Roguestar.Lib.Random
import Data.MemoCombinators
import Control.Arrow
View
47 src/HierarchicalDatabase.hs → Roguestar/Lib/HierarchicalDatabase.hs
@@ -1,23 +1,24 @@
-module HierarchicalDatabase
+module Roguestar.Lib.HierarchicalDatabase
(HierarchicalDatabase,
HierarchicalRelation(..),
- HierarchicalDatabase.empty,
- HierarchicalDatabase.insert,
- HierarchicalDatabase.delete,
- HierarchicalDatabase.lookup,
+ Roguestar.Lib.HierarchicalDatabase.empty,
+ Roguestar.Lib.HierarchicalDatabase.insert,
+ Roguestar.Lib.HierarchicalDatabase.delete,
+ Roguestar.Lib.HierarchicalDatabase.lookup,
lookupChildren,
lookupParent,
parentOf,
childrenOf,
- HierarchicalDatabase.toList,
- HierarchicalDatabase.fromList,
+ Roguestar.Lib.HierarchicalDatabase.toList,
+ Roguestar.Lib.HierarchicalDatabase.fromList,
insidenessTests)
where
-import Data.Map as Map
-import Data.List as List
-import Tests
+import Prelude hiding (lookup)
+import qualified Data.Map as Map
+import qualified Data.List as List
+import Roguestar.Lib.Tests
import Data.Maybe as Maybe
-- | A record that can be a component of a 'HierarchicalDatabase'.
@@ -30,16 +31,16 @@ instance (Integral a,Integral b) => HierarchicalRelation (a,b) where
child = toInteger . fst
-- | A tree or hierarchy based on records that represent parent-child relations.
-data HierarchicalDatabase a =
+data HierarchicalDatabase a =
HierarchicalDatabase {
- hd_children :: (Map Integer [Integer]),
- hd_parent :: (Map Integer a) }
+ hd_children :: (Map.Map Integer [Integer]),
+ hd_parent :: (Map.Map Integer a) }
instance (Show a) => Show (HierarchicalDatabase a) where
- show imap = show $ HierarchicalDatabase.toList imap
+ show imap = show $ toList imap
instance (HierarchicalRelation a,Read a) => Read (HierarchicalDatabase a) where
- readsPrec n = \v -> Prelude.map (\(x,y) -> (HierarchicalDatabase.fromList x,y)) (readsPrec n v)
+ readsPrec n = \v -> Prelude.map (\(x,y) -> (fromList x,y)) (readsPrec n v)
empty :: HierarchicalDatabase a
empty = HierarchicalDatabase (Map.empty) (Map.empty)
@@ -52,8 +53,8 @@ empty = HierarchicalDatabase (Map.empty) (Map.empty)
insert :: (HierarchicalRelation a) => a -> HierarchicalDatabase a -> HierarchicalDatabase a
insert a the_map =
HierarchicalDatabase {
- hd_children = alter (Just . maybe [child a] (child a :)) (parent a) $
- hd_children $ HierarchicalDatabase.delete (child a) the_map,
+ hd_children = Map.alter (Just . maybe [child a] (child a :)) (parent a) $
+ hd_children $ delete (child a) the_map,
hd_parent = Map.insert (child a) a $ hd_parent the_map }
-- |
@@ -62,7 +63,7 @@ insert a the_map =
delete :: (HierarchicalRelation a) => Integer -> HierarchicalDatabase a -> HierarchicalDatabase a
delete x the_map =
HierarchicalDatabase {
- hd_children = maybe (hd_children the_map) (\p -> update deleteChildFromList p $ hd_children the_map) xsParent,
+ hd_children = maybe (hd_children the_map) (\p -> Map.update deleteChildFromList p $ hd_children the_map) xsParent,
hd_parent = Map.delete x $ hd_parent the_map }
where deleteChildFromList l = case List.delete x l of
[] -> Nothing
@@ -86,13 +87,13 @@ lookup x the_map = (Map.lookup x $ hd_parent the_map,
-- Answers the child relations of a given key.
--
lookupChildren :: (HierarchicalRelation a) => Integer -> HierarchicalDatabase a -> [a]
-lookupChildren x the_map = snd $ HierarchicalDatabase.lookup x the_map
+lookupChildren x the_map = snd $ lookup x the_map
-- |
-- Answers the parent relation of a given key, if any.
--
lookupParent :: (HierarchicalRelation a) => Integer -> HierarchicalDatabase a -> Maybe a
-lookupParent x the_map = fst $ HierarchicalDatabase.lookup x the_map
+lookupParent x the_map = fst $ lookup x the_map
-- |
-- Answers the keys of the children for a given key.
@@ -111,7 +112,7 @@ toList the_map = List.map snd $ Map.toList $ hd_parent the_map
-- Converts a list of relations into a HierarchicalDatabase.
--
fromList :: (HierarchicalRelation a) => [a] -> HierarchicalDatabase a
-fromList as = foldr (HierarchicalDatabase.insert) HierarchicalDatabase.empty as
+fromList as = foldr (insert) empty as
data ExampleRelation = ExampleRelation (Integer,Integer,Bool)
@@ -120,7 +121,7 @@ instance HierarchicalRelation ExampleRelation where
child (ExampleRelation (_,n,_)) = n
example1 :: HierarchicalDatabase ExampleRelation
-example1 = HierarchicalDatabase.fromList $ List.map ExampleRelation
+example1 = fromList $ List.map ExampleRelation
[(1,13,True),
(1,(-5),True),
(1,1,True),
@@ -157,7 +158,7 @@ testChildrenCorrect = let the_children = childrenOf 4 example1
else return (Failed "testChildrenCorrect")
testDelete :: TestCase
-testDelete = let deleted = HierarchicalDatabase.delete 0 $ HierarchicalDatabase.delete (-6) $ example1
+testDelete = let deleted = delete 0 $ delete (-6) $ example1
in if ((length $ childrenOf 4 deleted) == 2 &&
(isNothing $ parentOf 0 deleted))
then return (Passed "testDelete")
View
2  src/Logging.hs → Roguestar/Lib/Logging.hs
@@ -1,4 +1,4 @@
-module Logging
+module Roguestar.Lib.Logging
(log_database,
log_plane,
log_travel,
View
2  src/Main.hs → Roguestar/Lib/Main.hs
@@ -10,7 +10,7 @@ import TerrainData
import Protocol
import GridRayCaster
import Data.Version
-import Paths_roguestar_engine
+import Paths_roguestar
import Data.List (intersperse)
import System.Log.Logger
View
12 src/Make.hs → Roguestar/Lib/Make.hs
@@ -1,14 +1,14 @@
-module Make
- (module MakeData,
+module Roguestar.Lib.Make
+ (module Roguestar.Lib.MakeData,
MakeOutcome,
resolveMake,
executeMake)
where
-import MakeData
-import DB
-import Tool
-import ToolData
+import Roguestar.Lib.MakeData
+import Roguestar.Lib.DB
+import Roguestar.Lib.Tool
+import Roguestar.Lib.ToolData
import Data.List
data MakeOutcome = MakeSuccess CreatureRef Tool [ToolRef] | MakeFailed
View
8 src/MakeData.hs → Roguestar/Lib/MakeData.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE FlexibleInstances #-}
-module MakeData
+module Roguestar.Lib.MakeData
(PrepareMake(..),
prepare_make,
isFinished,
@@ -13,9 +13,9 @@ module MakeData
MakeWith(..))
where
-import DBData
-import ToolData
-import Substances
+import Roguestar.Lib.DBData
+import Roguestar.Lib.ToolData
+import Roguestar.Lib.Substances
-- | Multi-step process for gathering the materials to make something.
data PrepareMake = PrepareMake {
View
39 src/Perception.hs → Roguestar/Lib/Perception.hs
@@ -6,38 +6,39 @@
-- is legal for a human agent or ai agent to have while choosing
-- it's next move.
--
-module Perception
+module Roguestar.Lib.Perception
(DBPerception,
whoAmI,
runPerception,
visibleObjects,
myFaction,
- Perception.getCreatureFaction,
+ Roguestar.Lib.Perception.getCreatureFaction,
whereAmI,
- Perception.whereIs,
+ Roguestar.Lib.Perception.whereIs,
localBiome,
compass,
depth)
where
import Control.Monad.Reader
+import Control.Monad.Random
import Data.Ord
-import DB
-import Reference
-import FactionData
-import Creature
-import PlaneVisibility
-import PlaneData
+import Roguestar.Lib.DB as DB
+import Roguestar.Lib.Reference
+import Roguestar.Lib.FactionData
+import Roguestar.Lib.Creature as Creature
+import Roguestar.Lib.PlaneVisibility
+import Roguestar.Lib.PlaneData
import Data.Maybe
import Data.List
-import Facing
-import Position
-import TerrainData
-import BuildingData
-import Building
-import Plane
-import DetailedLocation
-import Building
+import Roguestar.Lib.Facing
+import Roguestar.Lib.Position as Position
+import Roguestar.Lib.TerrainData
+import Roguestar.Lib.BuildingData
+import Roguestar.Lib.Building
+import Roguestar.Lib.Plane
+import Roguestar.Lib.DetailedLocation
+import Roguestar.Lib.Building
newtype (DBReadable db) => DBPerception db a = DBPerception { fromPerception :: (ReaderT CreatureRef db a) }
@@ -87,13 +88,13 @@ visibleObjects filterF =
liftDB $ mapRO DB.whereIs visible_objects
myFaction :: (DBReadable db) => DBPerception db Faction
-myFaction = Perception.getCreatureFaction =<< whoAmI
+myFaction = Roguestar.Lib.Perception.getCreatureFaction =<< whoAmI
getCreatureFaction :: (DBReadable db) => CreatureRef -> DBPerception db Faction
getCreatureFaction creature_ref = liftDB $ Creature.getCreatureFaction creature_ref
whereAmI :: (DBReadable db) => DBPerception db (Facing,Position)
-whereAmI = liftM detail $ Perception.whereIs =<< whoAmI
+whereAmI = liftM detail $ Roguestar.Lib.Perception.whereIs =<< whoAmI
whatPlaneAmIOn :: (DBReadable db) => DBPerception db PlaneRef
whatPlaneAmIOn = liftM (planar_parent . identityDetail) $ (\x -> liftDB $ getPlanarLocation x) =<< whoAmI
View
2  src/PersistantData.hs → Roguestar/Lib/PersistantData.hs
@@ -1,4 +1,4 @@
-module PersistantData
+module Roguestar.Lib.PersistantData
(CharacterClass(..),
PowerUpData(..),
PlanetRegion(..),
View
35 src/Plane.hs → Roguestar/Lib/Plane.hs
@@ -1,11 +1,11 @@
{-# LANGUAGE ScopedTypeVariables, FlexibleContexts, OverloadedStrings, PatternGuards, TypeFamilies #-}
-module Plane
+module Roguestar.Lib.Plane
(dbNewPlane,
planetName,
randomPlanetName,
planeDepth,
dbGetCurrentPlane,
- Plane.distanceBetweenSquared,
+ Roguestar.Lib.Plane.distanceBetweenSquared,
pickRandomClearSite_withTimeout,
pickRandomClearSite,
getPlanarLocation,
@@ -19,25 +19,26 @@ module Plane
where
import Prelude hiding (getContents)
-import Grids
-import Reference
-import DB
-import TerrainData
-import PlaneData
-import PlanetData
-import ToolData (Tool)
-import BuildingData (Building)
-import CreatureData (Creature)
+import Roguestar.Lib.Grids
+import Roguestar.Lib.Reference
+import Roguestar.Lib.DB
+import Roguestar.Lib.TerrainData
+import Roguestar.Lib.PlaneData
+import Roguestar.Lib.PlanetData
+import Roguestar.Lib.ToolData (Tool)
+import Roguestar.Lib.BuildingData (Building)
+import Roguestar.Lib.CreatureData (Creature)
import Control.Monad
+import Control.Monad.Random as Random
import Data.Maybe
import Data.List
-import Position
-import PlayerState
-import FactionData
-import DetailedLocation
+import Roguestar.Lib.Position as Position
+import Roguestar.Lib.PlayerState
+import Roguestar.Lib.FactionData
+import Roguestar.Lib.DetailedLocation
import qualified Data.ByteString.Char8 as B
-import BuildingData
-import Logging
+import Roguestar.Lib.BuildingData
+import Roguestar.Lib.Logging
import Control.Monad.Maybe
import Control.Monad.Trans
View
4 src/PlaneData.hs → Roguestar/Lib/PlaneData.hs
@@ -1,9 +1,9 @@
-module PlaneData
+module Roguestar.Lib.PlaneData
(Plane(..))
where
-import TerrainData
+import Roguestar.Lib.TerrainData
import qualified Data.ByteString.Char8 as B
data Plane = Plane
View
30 src/PlaneVisibility.hs → Roguestar/Lib/PlaneVisibility.hs
@@ -1,29 +1,29 @@
{-# LANGUAGE PatternGuards, FlexibleContexts, ScopedTypeVariables, RankNTypes #-}
-module PlaneVisibility
+module Roguestar.Lib.PlaneVisibility
(dbGetVisibleTerrainForFaction,
dbGetVisibleObjectsForFaction)
where
import Prelude hiding (getContents)
-import FactionData
-import DB
-import TerrainData
-import Plane
-import PlaneData
+import Roguestar.Lib.FactionData
+import Roguestar.Lib.DB
+import Roguestar.Lib.TerrainData
+import Roguestar.Lib.Plane
+import Roguestar.Lib.PlaneData
import Control.Monad
-import CreatureData
+import Roguestar.Lib.CreatureData
import Data.List
-import Grids
-import GridRayCaster
-import VisibilityData
-import Facing
+import Roguestar.Lib.Grids
+import Roguestar.Lib.GridRayCaster
+import Roguestar.Lib.VisibilityData
+import Roguestar.Lib.Facing
import Data.Ratio
-import Building
-import Position
+import Roguestar.Lib.Building
+import Roguestar.Lib.Position as Position
import Control.Applicative
-import Reference
-import DetailedLocation
+import Roguestar.Lib.Reference
+import Roguestar.Lib.DetailedLocation
dbGetSeersForFaction :: (DBReadable db) => Faction -> PlaneRef -> db [CreatureRef]
dbGetSeersForFaction faction plane_ref =
View
19 src/Planet.hs → Roguestar/Lib/Planet.hs
@@ -1,23 +1,24 @@
{-# LANGUAGE TypeFamilies #-}
-module Planet
+module Roguestar.Lib.Planet
(makePlanets,
generatePlanetInfo)
where
-import PlanetData
-import PlaneData
-import DB
-import Plane
-import TerrainData
+import Roguestar.Lib.PlanetData
+import Roguestar.Lib.PlaneData
+import Roguestar.Lib.DB
+import Roguestar.Lib.Plane
+import Roguestar.Lib.TerrainData
import Control.Monad
+import Control.Monad.Random
import Data.Maybe
import Data.Ord
-import Town
+import Roguestar.Lib.Town
import Data.List
import Data.ByteString.Char8 as B
-import FactionData
-import BuildingData
+import Roguestar.Lib.FactionData
+import Roguestar.Lib.BuildingData
makePlanet :: (LocationConstructor l, ReferenceTypeOf l ~ Plane) => l -> PlanetInfo -> DB PlaneRef
makePlanet plane_location planet_info =
View
8 src/PlanetData.hs → Roguestar/Lib/PlanetData.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
-module PlanetData
+module Roguestar.Lib.PlanetData
(PlanetRegion(..),
PlanetInfo(..),
addTown,
@@ -8,9 +8,9 @@ module PlanetData
cyborg_planets)
where
-import PersistantData
-import TerrainData
-import BuildingData
+import Roguestar.Lib.PersistantData
+import Roguestar.Lib.TerrainData
+import Roguestar.Lib.BuildingData
import Data.Ratio
import qualified Data.ByteString.Char8 as B
View
12 src/PlayerState.hs → Roguestar/Lib/PlayerState.hs
@@ -1,4 +1,4 @@
-module PlayerState
+module Roguestar.Lib.PlayerState
(PlayerState(..),
CreatureTurnMode(..),
SnapshotEvent(..),
@@ -8,11 +8,11 @@ module PlayerState
modifyMenuIndex)
where
-import DBData
-import CreatureData
-import CharacterData
-import MakeData
-import TravelData
+import Roguestar.Lib.DBData
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.CharacterData
+import Roguestar.Lib.MakeData
+import Roguestar.Lib.TravelData
data PlayerState =
SpeciesSelectionState
View
2  src/Position.hs → Roguestar/Lib/Position.hs
@@ -1,4 +1,4 @@
-module Position
+module Roguestar.Lib.Position
(Position(..),
MultiPosition,
multiPosition,
View
6 Roguestar/Lib/PowerUpData.hs
@@ -0,0 +1,6 @@
+module Roguestar.Lib.PowerUpData
+ (PowerUpData(..))
+ where
+
+import Roguestar.Lib.PersistantData
+
View
0  src/Protocol.hs → Roguestar/Lib/Protocol.hs
File renamed without changes
View
2  src/RNG.hs → Roguestar/Lib/RNG.hs
@@ -5,7 +5,7 @@
-- generate the same psuedo-random sequence when we reload it, even across
-- different environments.
--
-module RNG
+module Roguestar.Lib.RNG
(mkRNG,
RNG,
Random(..),
View
2  src/Random.hs → Roguestar/Lib/Random.hs
@@ -1,5 +1,5 @@
-module Random
+module Roguestar.Lib.Random
(pick,
pickM,
weightedPick,
View
12 src/Reference.hs → Roguestar/Lib/Reference.hs
@@ -1,16 +1,16 @@
{-# LANGUAGE ScopedTypeVariables #-}
-module Reference
+module Roguestar.Lib.Reference
(ReferenceType(..),
(=:=),
(=/=))
where
-import DBPrivate
-import PlaneData
-import BuildingData
-import ToolData
-import CreatureData
+import Roguestar.Lib.DBPrivate
+import Roguestar.Lib.PlaneData
+import Roguestar.Lib.BuildingData
+import Roguestar.Lib.ToolData
+import Roguestar.Lib.CreatureData
import Data.Either
import Data.Maybe
View
12 src/Species.hs → Roguestar/Lib/Species.hs
@@ -1,17 +1,17 @@
-module Species
+module Roguestar.Lib.Species
(player_species_names,
SpeciesData(..),
speciesInfo)
where
import Data.Char
-import CreatureData
-import CharacterData
-import SpeciesData
-import CreatureAttribute
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.CharacterData
+import Roguestar.Lib.SpeciesData
+import Roguestar.Lib.CreatureAttribute
import Data.Monoid
-import TerrainData
+import Roguestar.Lib.TerrainData
player_species_names :: [String]
player_species_names = map (map toLower . show) player_species
View
2  src/SpeciesData.hs → Roguestar/Lib/SpeciesData.hs
@@ -1,4 +1,4 @@
-module SpeciesData
+module Roguestar.Lib.SpeciesData
(Species(..),
all_species,
player_species)
View
6 src/Substances.hs → Roguestar/Lib/Substances.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
-module Substances
+module Roguestar.Lib.Substances
(Gas(..),
Material(..),
Chromalite(..),
@@ -20,13 +20,13 @@ module Substances
chromalitePotency)
where
-import Alignment
+import Roguestar.Lib.Alignment
import Data.List
import Data.Ord
import Data.Maybe
import qualified Data.ByteString.Char8 as B
-data Substance =
+data Substance =
GasSubstance Gas
| MaterialSubstance Material
| ChromaliteSubstance Chromalite
View
6 src/TerrainData.hs → Roguestar/Lib/TerrainData.hs
@@ -1,5 +1,5 @@
-module TerrainData
+module Roguestar.Lib.TerrainData
(Biome(..),
TerrainPatch(..),
TerrainGrid,
@@ -15,11 +15,11 @@ module TerrainData
impassable_terrains)
where
-import Grids
+import Roguestar.Lib.Grids
import Data.List as List
import Data.Map as Map
--import Substances hiding (Water)
-import RNG
+import Roguestar.Lib.RNG
import Data.Ratio
-- |
View
2  src/Tests.hs → Roguestar/Lib/Tests.hs
@@ -1,5 +1,5 @@
-module Tests
+module Roguestar.Lib.Tests
(TestResult(..),
TestCase,
test,
View
14 Roguestar/Lib/TimeCoordinate.hs
@@ -0,0 +1,14 @@
+module Roguestar.Lib.TimeCoordinate
+ (TimeCoordinate,
+ advanceTime,
+ zero_time)
+ where
+
+data TimeCoordinate = TimeCoordinate Rational
+ deriving (Eq,Ord,Read,Show)
+
+advanceTime :: Rational -> TimeCoordinate -> TimeCoordinate
+advanceTime x (TimeCoordinate t) = TimeCoordinate (t + x)
+
+zero_time :: TimeCoordinate
+zero_time = TimeCoordinate 0
View
16 src/Tool.hs → Roguestar/Lib/Tool.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE ScopedTypeVariables, PatternGuards #-}
-module Tool
+module Roguestar.Lib.Tool
(pickupTool,
wieldTool,
dropTool,
@@ -12,16 +12,16 @@ module Tool
where
import Prelude hiding (getContents)
-import DB
-import Reference
-import DetailedLocation
+import Roguestar.Lib.DB
+import Roguestar.Lib.Reference
+import Roguestar.Lib.DetailedLocation
import Control.Monad.Error
import Data.Maybe
import Data.List as List
-import ToolData
-import Substances
-import Plane
-import PlaneData
+import Roguestar.Lib.ToolData
+import Roguestar.Lib.Substances
+import Roguestar.Lib.Plane
+import Roguestar.Lib.PlaneData
pickupTool :: (DBReadable db) =>
CreatureRef ->
View
4 src/ToolData.hs → Roguestar/Lib/ToolData.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
-module ToolData
+module Roguestar.Lib.ToolData
(Tool(..),
fromSphere,
sphere,
@@ -25,7 +25,7 @@ module ToolData
kinetic_sabre)
where
-import Substances
+import Roguestar.Lib.Substances
import qualified Data.ByteString.Char8 as B
data Tool = DeviceTool DeviceFunction Device
View
10 src/Town.hs → Roguestar/Lib/Town.hs
@@ -1,11 +1,11 @@
-module Town
+module Roguestar.Lib.Town
(createTown)
where
-import BuildingData
-import DB
-import TerrainData
-import Plane
+import Roguestar.Lib.BuildingData
+import Roguestar.Lib.DB
+import Roguestar.Lib.TerrainData
+import Roguestar.Lib.Plane
-- | Create a town from a list of buildings.
createTown :: PlaneRef -> [BuildingPrototype] -> DB [BuildingRef]
View
24 src/Travel.hs → Roguestar/Lib/Travel.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE ScopedTypeVariables #-}
-module Travel
+module Roguestar.Lib.Travel
(stepCreature,
turnCreature,
ClimbOutcome,
@@ -12,22 +12,22 @@ module Travel
where
import Control.Monad.Maybe
-import Facing
-import DB
-import Plane
+import Roguestar.Lib.Facing
+import Roguestar.Lib.DB as DB
+import Roguestar.Lib.Plane
import Data.Maybe
import Control.Monad
import Control.Monad.Trans
import Data.Ord
-import Position
-import TerrainData
+import Roguestar.Lib.Position as Position
+import Roguestar.Lib.TerrainData
import Data.List (minimumBy)
-import Creature
-import CreatureData
-import Logging
-import TravelData
-import DetailedLocation
-import DetailedTravel
+import Roguestar.Lib.Creature
+import Roguestar.Lib.CreatureData
+import Roguestar.Lib.Logging
+import Roguestar.Lib.TravelData
+import Roguestar.Lib.DetailedLocation
+import Roguestar.Lib.DetailedTravel as DetailedTravel
walkCreature :: (DBReadable db) => Facing ->
(Integer,Integer) ->
View
2  src/TravelData.hs → Roguestar/Lib/TravelData.hs
@@ -1,5 +1,5 @@
-module TravelData
+module Roguestar.Lib.TravelData
(ClimbDirection(..)) where
data ClimbDirection = ClimbUp | ClimbDown
View
33 src/Turns.hs → Roguestar/Lib/Turns.hs
@@ -1,30 +1,31 @@
{-# LANGUAGE PatternGuards, ScopedTypeVariables #-}
-module Turns
+module Roguestar.Lib.Turns
(dbPerformPlayerTurn)
where
import Prelude hiding (getContents)
import Control.Monad.Maybe
import Control.Monad.Trans
-import DB
-import Reference
-import FactionData
-import SpeciesData
-import CreatureData (Creature)
-import Plane
+import Roguestar.Lib.DB
+import Roguestar.Lib.Reference
+import Roguestar.Lib.FactionData
+import Roguestar.Lib.SpeciesData
+import Roguestar.Lib.CreatureData (Creature)
+import Roguestar.Lib.Plane
import Control.Monad
-import Creature
+import Roguestar.Lib.Creature
import Data.Ratio
-import Facing
-import TerrainData
+import Roguestar.Lib.Facing
+import Roguestar.Lib.TerrainData
import Data.Maybe
-import Behavior
-import qualified Perception as P
-import Position
-import PlayerState
-import Logging
-import DetailedLocation
+import Roguestar.Lib.Behavior
+import qualified Roguestar.Lib.Perception as P
+import Roguestar.Lib.Position
+import Roguestar.Lib.PlayerState
+import Roguestar.Lib.Logging
+import Roguestar.Lib.DetailedLocation
+import Control.Monad.Random
dbPerformPlayerTurn :: Behavior -> CreatureRef -> DB ()
dbPerformPlayerTurn beh creature_ref =
View
6 src/VisibilityData.hs → Roguestar/Lib/VisibilityData.hs
@@ -1,14 +1,14 @@
-module VisibilityData
+module Roguestar.Lib.VisibilityData
(distanceCostForSight,
terrainHideMultiplier,
terrainOpacity,
maximumRangeForSpotCheck)
where
-import TerrainData
+import Roguestar.Lib.TerrainData
import Data.List
-import Facing
+import Roguestar.Lib.Facing
-- |
-- We multiply a creature's hide check by this number if it is standing on this terrain.
View
23 Roguestar/Server/Main.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE TemplateHaskell, OverloadedStrings #-}
+
+import qualified Data.Text as T
+import Snap
+import Snap.Util.FileServe
+import Data.Maybe
+import Data.Ord
+
+data App = App
+
+makeLenses [''App]
+
+appInit :: SnapletInit App App
+appInit = makeSnaplet "taskflask" "Task Flask" Nothing $
+ do addRoutes [("/static", static)]
+ return App
+
+static :: Handler b v ()
+static = serveDirectory "./static/"
+
+main :: IO ()
+main = serveSnaplet defaultConfig appInit
+
View
126 roguestar.cabal
@@ -1,33 +1,105 @@
-name: roguestar-engine
-version: 0.7.0.0
-cabal-version: >=1.2
-build-type: Simple
-license: OtherLicense
-license-file: LICENSE
-maintainer: Christopher Lane Hinson <lane@downstairspeople.org>
-homepage: http://roguestar.downstairspeople.org/
-synopsis: Sci-fi roguelike game. Backend.
-description: Requires roguestar and roguestar-glut.
-category: Game
-author: Christopher Lane Hinson
-tested-with: GHC ==6.12.1
-
-executable roguestar-engine
- main-is: Main.hs
- hs-source-dirs: src
- build-depends: hslogger >=1.1.0 ,
- priority-sync >=0.2.1.1 && <0.3, PSQueue >=1.1 && <1.2,
- bytestring >=0.9.1.5, parallel >=2.2.0.1 ,
- stm >=2.1.1.2, data-memocombinators >=0.4.0 && <0.5,
- MonadRandom >=0.1.4 && <0.2, MaybeT >=0.1.2 && <0.2,
- mtl >=1.1.0.2, random >=1.0.0.2 && <1.1,
- old-time >=1.0.0.3 && <1.1, array >=0.3.0.0 && <0.3.1,
- containers >=0.3.0.0, base >=4 && <5
- other-modules: TravelData, VisibilityData, FactionData, Behavior, Alignment, PlaneData, Grids, Perception, PlaneVisibility, Turns, Plane, CreatureData, Protocol, Character, Tool, Substances, HierarchicalDatabase, Travel, ToolData, CharacterData, Creature, Facing, DBPrivate, RNG, Species, Position, TerrainData, Combat, Tests, DBData, GridRayCaster, BeginGame, SpeciesData, TimeCoordinate, DB, AttributeGeneration, CreatureAttribute, Building, BuildingData, Town, Random, PlayerState, MakeData, DBErrorFlag, Construction, Make, Activate, Contact, DeviceActivation, WorkCluster, Planet, PlanetData, Logging, PowerUpData, CharacterAdvancement, PersistantData
+name: roguestar
+version: 0.7.1.0
+cabal-version: >=1.2
+build-type: Simple
+license: OtherLicense
+license-file: LICENSE
+maintainer: Christopher Lane Hinson <lane@downstairspeople.org>
+homepage: http://roguestar.downstairspeople.org/
+synopsis: Sci-fi roguelike game.
+description: A sci-fi roguelike game.
+category: Game
+author: Christopher Lane Hinson
+tested-with: GHC ==7.0.4
+
+executable roguestar-server
+ main-is: Roguestar/Server/Main.hs
+ hs-source-dirs: .
+ build-depends: snap >=0.8,
+ snap-core >=0.8,
+ text >=0.11,
+ containers >=0.3.0.0,
+ base >=4
ghc-prof-options: -prof -auto-all
ghc-shared-options: -prof -auto-all
if impl(ghc >= 7.0)
ghc-options: -threaded -fno-warn-type-defaults -rtsopts=all
else
ghc-options: -threaded -fno-warn-type-defaults
-
+
+library
+ hs-source-dirs: .
+ build-depends: hslogger >=1.1.0,
+ bytestring >=0.9.1.5,
+ parallel >=2.2.0.1,
+ stm >=2.1.1.2,
+ data-memocombinators >=0.4.0,
+ MonadRandom >=0.1.4,
+ MaybeT >=0.1.2,
+ mtl >=1.1.0.2,
+ random >=1.0.0.2,
+ old-time >=1.0.0.3,
+ array >=0.3.0.0,
+ containers >=0.3.0.0,
+ base >=4
+ other-modules: Roguestar.Lib.TravelData,
+ Roguestar.Lib.VisibilityData,
+ Roguestar.Lib.FactionData,
+ Roguestar.Lib.Behavior,
+ Roguestar.Lib.Alignment,
+ Roguestar.Lib.PlaneData,
+ Roguestar.Lib.Grids,
+ Roguestar.Lib.Perception,
+ Roguestar.Lib.PlaneVisibility,
+ Roguestar.Lib.Turns,
+ Roguestar.Lib.Plane,
+ Roguestar.Lib.CreatureData,
+ Roguestar.Lib.Character,
+ Roguestar.Lib.Tool,
+ Roguestar.Lib.Substances,
+ Roguestar.Lib.HierarchicalDatabase,
+ Roguestar.Lib.Travel,
+ Roguestar.Lib.ToolData,
+ Roguestar.Lib.CharacterData,
+ Roguestar.Lib.Creature,
+ Roguestar.Lib.Facing,
+ Roguestar.Lib.DBPrivate,
+ Roguestar.Lib.RNG,
+ Roguestar.Lib.Species,
+ Roguestar.Lib.Position,
+ Roguestar.Lib.TerrainData,
+ Roguestar.Lib.Combat,
+ Roguestar.Lib.Tests,
+ Roguestar.Lib.DBData,
+ Roguestar.Lib.GridRayCaster,
+ Roguestar.Lib.BeginGame,
+ Roguestar.Lib.SpeciesData,
+ Roguestar.Lib.TimeCoordinate,
+ Roguestar.Lib.DB,
+ Roguestar.Lib.AttributeGeneration,
+ Roguestar.Lib.CreatureAttribute,
+ Roguestar.Lib.Building,
+ Roguestar.Lib.BuildingData,
+ Roguestar.Lib.Town,
+ Roguestar.Lib.Random,
+ Roguestar.Lib.PlayerState,
+ Roguestar.Lib.MakeData,
+ Roguestar.Lib.DBErrorFlag,
+ Roguestar.Lib.Construction,
+ Roguestar.Lib.Make,
+ Roguestar.Lib.Activate,
+ Roguestar.Lib.Contact,
+ Roguestar.Lib.DeviceActivation,
+ Roguestar.Lib.Planet,
+ Roguestar.Lib.PlanetData,
+ Roguestar.Lib.Logging,
+ Roguestar.Lib.CharacterAdvancement,
+ Roguestar.Lib.PersistantData,
+ Roguestar.Lib.PowerUpData
+ ghc-prof-options: -prof -auto-all
+ ghc-shared-options: -prof -auto-all
+ if impl(ghc >= 7.0)
+ ghc-options: -threaded -fno-warn-type-defaults -rtsopts=all
+ else
+ ghc-options: -threaded -fno-warn-type-defaults
+
View
6 src/PowerUpData.hs
@@ -1,6 +0,0 @@
-module PowerUpData
- (PowerUpData(..))
- where
-
-import PersistantData
-
View
24 src/TimeCoordinate.hs
@@ -1,24 +0,0 @@
---
--- Right now this is a simple abstraction over Rational.
--- In the future, when we implement time travel, it will be more interesting.
---
--- 1 = 1 minute, or 1 round. Nothing should ever take longer than a round.
--- A typical creature should be able to move about 20 squares in a round.
--- Weapons should do ideal damage at a standard rate of 100 points of damage per round.
--- Creatures should heal their entire hit points in exactly one round, after not taking any damage for one round.
---
-
-module TimeCoordinate
- (TimeCoordinate,
- advanceTime,
- zero_time)
- where
-
-data TimeCoordinate = TimeCoordinate Rational
- deriving (Eq,Ord,Read,Show)
-
-advanceTime :: Rational -> TimeCoordinate -> TimeCoordinate
-advanceTime x (TimeCoordinate t) = TimeCoordinate (t + x)
-
-zero_time :: TimeCoordinate
-zero_time = TimeCoordinate 0
View
92 src/WorkCluster.hs
@@ -1,92 +0,0 @@
-module WorkCluster
- (WorkCluster,
- WorkRequestType(..),
- WorkRequest,
- WorkResult,
- newWorkCluster,
- workRequest,
- replaceWorkOperation)
- where
-
-import PrioritySync.PrioritySync
-import Control.Concurrent.MVar
-import Control.Monad
-import Control.Applicative
-import Data.IORef
-import qualified Data.ByteString as B
-import qualified Data.PSQueue as PSQ
-import qualified Data.Map as Map
-import DB
-
--- | Measure the number of 'Query's between 'Action's, and add this number to get the maximum size of the most-recent-request queue.
-queue_size_bonus :: Int
-queue_size_bonus = 10
-
-data WorkRequestType = Query | Action deriving (Eq,Ord,Show)
-type WorkRequest = (WorkRequestType,[B.ByteString])
-type WorkResult = Either DBError (B.ByteString,DB_BaseType)
-
-data WorkPrio = Now | Eventually deriving (Eq,Ord)
-
-data WorkClusterData = WorkClusterData {
- wc_queue_max_size :: IORef Int, -- how large the most-recent-requests queue should be allowed to grow
- wc_recent_request_count :: IORef Int, -- number of manual requests since the last 'replaceWorkOperation'
- wc_abort_counter :: IORef Integer, -- increments on every 'replaceWorkOperation'
- wc_request_counter :: IORef Integer, -- increments on every manual request
- wc_recent_requests :: IORef (PSQ.PSQ WorkRequest Integer),
- wc_task_pool :: IORef (TaskPool WorkPrio ()),
- wc_request_operation :: IORef (WorkRequest -> IO WorkResult),
- wc_task_handles :: IORef (Map.Map WorkRequest (TaskHandle WorkPrio WorkResult)) }
-
-data WorkCluster = WorkCluster (MVar WorkClusterData)
-
-newWorkCluster :: IO WorkCluster
-newWorkCluster = liftM WorkCluster . newMVar =<< (WorkClusterData <$>
- newIORef 0 <*> newIORef 0 <*> newIORef 0 <*> newIORef 0 <*> newIORef PSQ.empty <*> (newIORef =<< simpleTaskPool) <*>
- newIORef (error "newWorkCluster: please call 'replaceWorkOperation' at least once") <*>
- newIORef Map.empty)
-
-startWork :: WorkCluster -> WorkRequest -> WorkPrio -> IO (TaskHandle WorkPrio WorkResult)
-startWork (WorkCluster wc_data_var) work_request prio = liftM snd $ withMVar wc_data_var $ \wc_data ->
- do when (prio == Now) $
- do modifyIORef (wc_recent_request_count wc_data) succ
- modifyIORef (wc_request_counter wc_data) succ
- c <- readIORef $ wc_request_counter wc_data
- modifyIORef (wc_recent_requests wc_data) $ PSQ.insertWith max work_request c
- queue_max_size <- readIORef $ wc_queue_max_size wc_data
- modifyIORef (wc_recent_requests wc_data) $ \psq -> if PSQ.size psq >= queue_max_size then PSQ.deleteMin psq else psq
- handles <- readIORef (wc_task_handles wc_data)
- case (Map.lookup work_request handles) of
- Just handle ->
- do reprioritize handle $ min prio
- return (wc_data, handle)
- Nothing ->
- do pool <- readIORef $ wc_task_pool wc_data
- op <- readIORef $ wc_request_operation wc_data
- result <- dispatch (schedule pool prio) $ op work_request
- modifyIORef (wc_task_handles wc_data) $ Map.insert work_request result
- return (wc_data, result)
-
-workRequest :: WorkCluster -> WorkRequest -> IO WorkResult
-workRequest work_cluster work_request = getResult =<< startWork work_cluster work_request Now
-
-replaceWorkOperation :: WorkCluster -> (WorkRequest -> IO WorkResult) -> IO ()
-replaceWorkOperation (WorkCluster wc_data_var) op =
- do recent_requests <- liftM snd $ withMVar wc_data_var $ \wc_data ->
- do pool <- readIORef $ wc_task_pool wc_data
- startQueue pool
- modifyIORef (wc_task_handles wc_data) $ const Map.empty
- modifyIORef (wc_abort_counter wc_data) succ
- id $ do queue_max_size <- readIORef $ wc_queue_max_size wc_data -- grow/shrink the most-recently-used request queue according to actual usage
- recent_request_count <- readIORef $ wc_recent_request_count wc_data
- writeIORef (wc_recent_request_count wc_data) 0
- writeIORef (wc_queue_max_size wc_data) $ max (queue_max_size - 1 :: Int) ((recent_request_count :: Int) + queue_size_bonus)
- key_abort_index <- readIORef $ wc_abort_counter wc_data
- writeIORef (wc_request_operation wc_data) $ \wo ->
- do current_abort_index <- readIORef $ wc_abort_counter wc_data
- case key_abort_index == current_abort_index of
- False -> return $ error "replaceWorkOperation: operation aborted"
- True -> op wo
- liftM ((,) wc_data . PSQ.keys) $ readIORef $ wc_recent_requests wc_data
- forM_ recent_requests $ \work_request -> startWork (WorkCluster wc_data_var) work_request Eventually
-
View
661 static/LICENSE.txt
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and